Authored by zhangwenxue

fix(商品详情): fix #6168 cube-scroll

【ufo前端】【闲鱼合作】买家求购选择尺码页面,展示的尺码不能下拉,导致后面最大的尺码无法选择进行求购

cube-scroll需要刷新的时机:
1: data 更新,可通过在 cube-scroll 上绑定:data 解决,无论是否使用自定义内容
2:如果外部组件使用了 transition要在 transition 结束时,重新刷新 scroll,可通过监控 after-enter 事件实现
... ... @@ -73,6 +73,7 @@ export default {
this.$emit('hidden');
},
shown() {
this.$emit('shown');
if (this._shownCallback) {
this.$nextTick(() => {
this._shownCallback();
... ...
... ... @@ -3,7 +3,7 @@
<div class="activity-sheet">
<h3>活动详情</h3>
<div class="list" >
<cube-scroll ref="activityListScroll">
<cube-scroll ref="activityListScroll" :data="list">
<ul>
<li v-for="(item, idx) in list" :key="idx">
<div><span>{{item.promotionTypeStr}}</span> {{item.activityName}}</div>
... ...
<template>
<action-sheet @hidden="onHidden" position="right" ref="popup"
<action-sheet position="right" ref="popup"
@hidden="onHidden"
@shown="onShown"
:panelStyle="{background: 'transparent', paddingLeft: '20%'}"
:hasBorderRadius="false"
:emulateMask="true">
... ... @@ -14,7 +16,7 @@
<div>{{productDetail.product_name}} {{goodsName}}</div>
</div>
<div class="size-list">
<cube-scroll>
<cube-scroll ref="scroll" :data="sizeViewList">
<ul>
<li :class="['size-item', item.available ? '': 'disable']" v-for="(item, idx) in sizeViewList" :key="idx" @click="buy(item)">
<div class="size"><span>{{item.name}}</span><span v-if="item.subName">{{item.subName}}</span></div>
... ... @@ -96,6 +98,12 @@ export default {
onHidden() {
this.$emit('hidden');
},
onShown() {
// refresh list
if (this.$refs.scroll) {
this.$refs.scroll.refresh();
}
},
buy(product) {
this.$yoho.auth()
.then(() => {
... ...
<template>
<div class="size-list">
<cube-scroll ref="sizeselectScroll">
<cube-scroll ref="sizeselectScroll" :data="viewList">
<ul>
<li v-for="(info, idx) in viewList"
:key="idx"
... ... @@ -34,7 +34,7 @@ export default {
name: 'size-list',
props: {
list: {
type: Array,
type: [Array, null],
required: true,
},
addSize: {
... ... @@ -82,13 +82,6 @@ export default {
return this.list.map(this.simplePriceMap);
},
},
mounted() {
this.$watch('list', () => {
this.refreshScroll();
}, {
immediate: true,
});
},
methods: {
priceMap(info) {
let price;
... ...
<template>
<action-sheet @hidden="onHidden" position="right" ref="popup">
<action-sheet @hidden="onHidden" @shown="onShown" position="right" ref="popup">
<div class="buy-sheet">
<div class="header">
<div class="back-wrapper flex" @touchend="onBack">
... ... @@ -10,7 +10,8 @@
<h1>添加尺码</h1>
<h3>请选择希望添加的尺码</h3>
</div>
<size-list :list="unusedSizeList"
<size-list ref="sizeList"
:list="unusedSizeList"
:multiple="true"
:simple-price="true"
:selected="selected"
... ... @@ -71,6 +72,11 @@ export default {
onHidden() {
this.$emit('hidden');
},
onShown() {
if (this.$refs.sizeList) {
this.$refs.sizeList.refreshScroll();
}
},
_requestSize() {
const sizeIds = this.selected.map(item => item.size_id).join(',');
... ...
<template>
<action-sheet @hidden="onHidden" ref="popup">
<action-sheet @hidden="onHidden" @shown="onShown" ref="popup">
<div class="size-select-sheet">
<div class="select-size">
<div class="title" @click="hide">{{config.title}}<i class="cubeic-close"></i></div>
... ... @@ -19,7 +19,8 @@
</div>
</div>
</div>
<size-list class="select-content size-list" :list="list"
<size-list class="select-content size-list" ref="sizeList"
:list="list"
:addSize="canAddSize"
:selected="selectedSize"
:config="config"
... ... @@ -146,6 +147,11 @@ export default {
onHidden() {
this.$emit('hidden');
},
onShown() {
if (this.$refs.sizeList) {
this.$refs.sizeList.refreshScroll();
}
},
onSelectSize({selected: sizeInfo}) {
this.updateTradeInfo({
productId: this.product.product_id,
... ...
... ... @@ -6,10 +6,9 @@
</transition>
</LayoutHeader>
<div class="layout-context fixscroll">
<cube-scroll
<cube-scroll :data="imageList"
:scroll-events="['scroll']"
@scroll="handleScroll">
<div class="slide">
<cube-slide ref="slide" :data="imageList">
<cube-slide-item v-for="(item, index) in imageList" :key="index">
... ...