51 lines
995 B
JavaScript
51 lines
995 B
JavaScript
const MescrollMoreItemMixin = {
|
|
// #ifndef MP-ALIPAY || MP-DINGTALK
|
|
props:{
|
|
i: Number,
|
|
index: {
|
|
type: Number,
|
|
default(){
|
|
return 0
|
|
}
|
|
}
|
|
},
|
|
// #endif
|
|
data() {
|
|
return {
|
|
downOption:{
|
|
auto:false
|
|
},
|
|
upOption:{
|
|
auto:false
|
|
},
|
|
isInit: false
|
|
}
|
|
},
|
|
watch:{
|
|
index(val){
|
|
if (this.i === val && !this.isInit) {
|
|
this.isInit = true;
|
|
this.mescroll && this.mescroll.triggerDownScroll();
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
mescrollInitByRef() {
|
|
if(!this.mescroll || !this.mescroll.resetUpScroll){
|
|
let mescrollRef = this.$refs.mescrollRef || this.$refs['mescrollRef'+this.i];
|
|
if(mescrollRef) this.mescroll = mescrollRef.mescroll
|
|
}
|
|
},
|
|
mescrollInit(mescroll) {
|
|
this.mescroll = mescroll;
|
|
this.mescrollInitByRef && this.mescrollInitByRef(); // 兼容字节跳动小程序
|
|
if(this.i === this.index){
|
|
this.isInit = true; // 标记为true
|
|
this.mescroll.triggerDownScroll();
|
|
}
|
|
},
|
|
}
|
|
}
|
|
|
|
export default MescrollMoreItemMixin;
|