123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <template>
- <view class="skeleton" :class="{ 'skeleton--animate': animate }">
- <!-- 轮播图骨架 -->
- <view class="skeleton__banner"></view>
-
- <!-- 价格区域骨架 -->
- <view class="skeleton__price">
- <view class="skeleton__price-main"></view>
- <view class="skeleton__price-market"></view>
- </view>
-
- <!-- 标题骨架 -->
- <view class="skeleton__title">
- <view class="skeleton__title-line"></view>
- <view class="skeleton__title-line" style="width: 80%;"></view>
- </view>
-
- <!-- 标签骨架 -->
- <view class="skeleton__tags">
- <view class="skeleton__tag"></view>
- <view class="skeleton__tag"></view>
- <view class="skeleton__tag"></view>
- </view>
-
- <!-- 规格骨架 -->
- <view class="skeleton__specs">
- <view class="skeleton__spec-item"></view>
- <view class="skeleton__spec-item"></view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: 'goods-skeleton',
- props: {
- animate: {
- type: Boolean,
- default: true
- }
- }
- }
- </script>
- <style lang="scss">
- .skeleton {
- padding: 30rpx;
- background: #fff;
-
- &--animate {
- .skeleton__banner,
- .skeleton__price-main,
- .skeleton__price-market,
- .skeleton__title-line,
- .skeleton__tag,
- .skeleton__spec-item {
- background: linear-gradient(
- 90deg,
- #f2f2f2 25%,
- #e6e6e6 37%,
- #f2f2f2 63%
- );
- background-size: 400% 100%;
- animation: skeleton-loading 1.4s ease infinite;
- }
- }
-
- &__banner {
- width: 100%;
- height: 750rpx;
- background: #f2f2f2;
- border-radius: 12rpx;
- margin-bottom: 30rpx;
- }
-
- &__price {
- margin-bottom: 20rpx;
-
- &-main {
- width: 200rpx;
- height: 56rpx;
- background: #f2f2f2;
- border-radius: 6rpx;
- margin-bottom: 12rpx;
- }
-
- &-market {
- width: 160rpx;
- height: 32rpx;
- background: #f2f2f2;
- border-radius: 4rpx;
- }
- }
-
- &__title {
- margin-bottom: 20rpx;
-
- &-line {
- width: 100%;
- height: 40rpx;
- background: #f2f2f2;
- border-radius: 4rpx;
- margin-bottom: 12rpx;
-
- &:last-child {
- margin-bottom: 0;
- }
- }
- }
-
- &__tags {
- display: flex;
- flex-wrap: wrap;
- margin: 0 -8rpx 20rpx;
- }
-
- &__tag {
- width: 120rpx;
- height: 48rpx;
- background: #f2f2f2;
- border-radius: 24rpx;
- margin: 8rpx;
- }
-
- &__specs {
- display: flex;
- flex-direction: column;
- gap: 20rpx;
- }
-
- &__spec-item {
- width: 100%;
- height: 88rpx;
- background: #f2f2f2;
- border-radius: 8rpx;
- }
- }
- @keyframes skeleton-loading {
- 0% {
- background-position: 100% 50%;
- }
- 100% {
- background-position: 0 50%;
- }
- }
- </style>
|