首页数据不刷新问题

This commit is contained in:
李彪 2025-04-30 13:33:40 +08:00
parent 3c78631953
commit 6870af63cb
2 changed files with 18 additions and 4 deletions

View File

@ -52,9 +52,16 @@ export default {
mounted() {
uni.hideLoading() // Loading
},
onLoad() {},
onLoad() {
uni.$off('reset')
uni.$on('reset', () => {
console.log('%c%s', 'color:red', 'reset')
this.getDataFn()
})
},
onShow() {
this.getDataFn()
console.log('%c%s', 'color:red', 'onSHow')
},
methods: {
async getDataFn() {

View File

@ -40,13 +40,13 @@
<u-empty v-if="!sonList.length" text="数据为空" mode="list"></u-empty>
</scroll-view>
</view>
<!-- 筛选的下拉 -->
<u-action-sheet :list="options" title="请选择" @click="changeFn" v-model:value="selectShow"></u-action-sheet>
<!-- 弹窗 -->
<bind-dialog ref="dialogRef" :visible="showDialog" @close="showDialog = false" :currentRow="currentRow" @changeBinding="onChangeBinding" @confirm="onConfirm" @closeRes="closeResFn"></bind-dialog>
<u-tabbar :list="vuex_tabbar"></u-tabbar>
<u-tabbar :list="vuex_tabbar" :before-switch="beforeSwitch"></u-tabbar>
</view>
</template>
<script>
@ -109,8 +109,14 @@ export default {
},
onShow() {
this.getDataFn()
console.log('%c%s', 'color:red', 'onSHow')
},
methods: {
beforeSwitch(e) {
console.log(e, 'e-')
uni.$emit('reset')
return true
},
dialogShowFn(row) {
// console.log(this.vuex_userData.nfcwrite)
// return
@ -168,7 +174,7 @@ export default {
const res = await GetRegionDataListApi()
console.log(res, '区域数据')
this.tabsList = res.data
if (this.tabsList.length > 0) {
if (this.tabsList?.length > 0) {
this.tabCurrentId = this.tabsList[0].id
this.getSonAreaFn()
}
@ -179,6 +185,7 @@ export default {
uni.showToast({ title: '绑定成功', icon: 'none' })
setTimeout(() => {
this.getSonAreaFn()
this.getDataFn()
}, 500)
},
//