diff --git a/src/sku/README.md b/src/sku/README.md index 116baedd9..af98024c0 100644 --- a/src/sku/README.md +++ b/src/sku/README.md @@ -140,6 +140,9 @@ export default { | start-sale-num `v2.3.0` | Minimum quantity | _number_ | `1` | | properties `v2.4.2` | Goods properties | _array_ | - | | preview-on-click-image `v2.5.2` | Whether to preview image when click goods image | _boolean_ | `true` | +| supportBigPicture `v2.9.0` | Whether to display large image mode | _boolean_ | `false` | +| supportBigPictureIndex `v2.9.0` | The index value of the large image mode | _number_ | `0` | +| hasScrollTab `v2.9.0` | Whether the large image mode displays a scroll bar | _boolean_ | `false` | ### Events diff --git a/src/sku/README.zh-CN.md b/src/sku/README.zh-CN.md index 8128a8392..83a4715d6 100644 --- a/src/sku/README.zh-CN.md +++ b/src/sku/README.zh-CN.md @@ -144,6 +144,9 @@ export default { | start-sale-num `v2.3.0` | 起售数量 | _number_ | `1` | | properties `v2.4.2` | 商品属性 | _array_ | - | | preview-on-click-image `v2.5.2` | 是否在点击商品图片时自动预览 | _boolean_ | `true` | +| supportBigPicture `v2.9.0` | 是否展示大图模式 | _boolean_ | `false` | +| supportBigPictureIndex `v2.9.0` | 多规格情况下,大图模式的索引值 | _number_ | `0` | +| hasScrollTab `v2.9.0` | 大图模式下,是否展示滚动条 | _boolean_ | `false` | ### Events diff --git a/src/sku/Sku.js b/src/sku/Sku.js index 3b20b861d..b752ee5ed 100644 --- a/src/sku/Sku.js +++ b/src/sku/Sku.js @@ -1,6 +1,7 @@ import Vue from 'vue'; import Popup from '../popup'; import Toast from '../toast'; +import Lazyload from '../lazyload'; import ImagePreview from '../image-preview'; import SkuHeader from './components/SkuHeader'; import SkuHeaderItem from './components/SkuHeaderItem'; @@ -25,6 +26,8 @@ const namespace = createNamespace('sku'); const [createComponent, bem, t] = namespace; const { QUOTA_LIMIT } = LIMIT_TYPE; +Vue.use(Lazyload); + export default createComponent({ props: { sku: Object, @@ -98,6 +101,18 @@ export default createComponent({ type: Boolean, default: true, }, + supportBigPicture: { + type: Boolean, + default: false, + }, + supportBigPictureIndex: { + type: Number, + default: 0, + }, + hasScrollTab: { + type: Boolean, + default: false, + }, }, data() { @@ -616,8 +631,10 @@ export default createComponent({ selectedNum, stepperTitle, selectedSkuComb, + supportBigPicture, + supportBigPictureIndex, + hasScrollTab, } = this; - const slotsProps = { price, originPrice, @@ -634,6 +651,7 @@ export default createComponent({ goods={goods} skuEventBus={skuEventBus} selectedSku={selectedSku} + supportBigPicture={supportBigPicture} > @@ -156,6 +188,7 @@ export default { button1: '积分兑换', button2: '买买买', actionsTop: '商品不多,赶快购买吧', + bigPicture: 'sku大图模式', }, 'en-US': { title2: 'Custom Stepper Related Config', @@ -164,6 +197,7 @@ export default { button1: 'Button', button2: 'Button', actionsTop: 'Action top info', + bigPicture: 'sku big picture mode', }, }, @@ -176,6 +210,7 @@ export default { showCustom: false, showStepper: false, showSoldout: false, + showBigPictureMode: false, closeOnClickOverlay: true, customSkuValidator: () => '请选择xxx', customStepperConfig: { diff --git a/src/sku/index.less b/src/sku/index.less index 1cc28c67e..7fcee3dbf 100644 --- a/src/sku/index.less +++ b/src/sku/index.less @@ -56,6 +56,10 @@ min-height: 96px; padding: @padding-sm 20px @padding-sm @padding-xs; overflow: hidden; + + &--no-padding { + padding-left: 0; + } } } @@ -123,6 +127,92 @@ margin-bottom: 0; } + &__picture { + margin-right: 0; + + &-item { + position: relative; + flex: 0 0 110px; + width: 110px; + height: 150px; + margin: 0 4px 6px 0; + color: @text-color; + border: 1px solid rgba(0, 0, 0, 0); + border-radius: @border-radius-md; + cursor: pointer; + + &::before { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: @sku-item-background-color; + border-radius: @border-radius-md; + content: ''; + } + + &-img { + position: absolute; + top: 0; + left: 0; + z-index: 1; + display: block; + width: 110px; + height: 110px; + object-fit: cover; + border-radius: @border-radius-md @border-radius-md 0 0; + + &-icon { + position: absolute; + top: 0; + right: 0; + z-index: 3; + width: 18px; + height: 19px; + opacity: 1 !important; + } + } + + &-name { + position: absolute; + top: 110px; + left: 0; + z-index: 1; + display: flex; + align-items: center; + justify-content: center; + box-sizing: border-box; + width: 110px; + height: 40px; + padding: @padding-base; + font-size: 12px; + line-height: 16px; + } + + &--active { + color: @red; + border: 1px solid currentColor; + + &::before { + background: currentColor; + opacity: 0.1; + } + } + + &--disabled { + color: @gray-5; + cursor: not-allowed; + + &::before { + z-index: 2; + background: @active-color; + opacity: 0.4; + } + } + } + } + &__title { padding-bottom: @padding-sm; } @@ -189,6 +279,44 @@ } } } + &__content { + overflow-x: scroll; + ::-webkit-scrollbar { + display: none; + } + + &__top { + display: inline-flex; + margin-bottom: 4px; + } + + &__bottom { + display: inline-flex; + margin-bottom: 4px; + } + } + + &__scroll { + display: flex; + justify-content: center; + height: 4px; + padding-bottom: 16px; + + &__content { + position: relative; + width: 40px; + height: 4px; + background: #ebedf0; + border-radius: 2px; + + &--active { + width: 20px; + height: 4px; + background: #f44; + border-radius: 2px; + } + } + } } &-stepper-stock {