修复自定义弹框穿透触发scroll-view下拉刷新bug
解决思路:
弹框出现的时候,禁止掉scroll-view的自定义下拉刷新
父组件---scroll-view
HTML:
<view class="tab-content">
<scroll-view
class="scroll"
:scroll-y='true'
:refresher-enabled="refershEnable"
:refresher-triggered="refresherTriggered"
@refresherrefresh="onRefresh"
@refresherrestore="refresherrestore"
@refresherabort="refresherabort"
>
<!-- 详情信息 -->
<messageView
v-if="clickTab == 'message'"
:mushroomKey="mushroomKey"
ref='message'
@getModal='getModal'
/>s
<!-- 数据分析 -->
<pieChartView
v-if="clickTab == 'pieChart'"
:mushroomKey='mushroomKey'
ref='pieChart'
/>
</scroll-view>
</view>
</view>
js:
data() {
return {
refershEnable: true,
}
}
methods: {
getModal(show_modal) {
this.show_modal = show_modal;
if (show_modal) {
this.refershEnable = false;
} else {
this.refershEnable = true;
}
},
}
子组件--监听状态变化,将当前弹框状态传值给父组件
watch: {
show_modal(newVal) {
if (newVal != undefined) {
this.$emit("getModal", newVal);
}
},
},
|