修正用户名显示逻辑进入服务列表页面自动刷新

This commit is contained in:
zhonghua.li
2026-04-17 08:12:56 +08:00
parent d74bc2ad1f
commit 18455a311d
14 changed files with 132 additions and 72 deletions

View File

@@ -1,6 +1,10 @@
<template>
<view class="subpackage-host">
<FurnitureReceptionImpl v-if="implReady" :incomingTab="incomingTab" />
<FurnitureReceptionImpl
v-if="implReady"
ref="furnitureReceptionImpl"
:incomingTab="incomingTab"
/>
<view v-else class="loading">
<text v-if="error">{{ error }}</text>
<text v-else>正在加载接待模块...</text>
@@ -9,11 +13,16 @@
</template>
<script>
// 微信小程序pages.json 的 componentPlaceholder 注册分包组件requiredComponents / 分包异步化)
// #ifndef MP-WEIXIN
import FurnitureReceptionImpl from '@/pages-subpackage/furniture_reception/furniture_reception-impl.vue';
// #endif
export default {
components: {
// #ifndef MP-WEIXIN
FurnitureReceptionImpl
// #endif
},
data() {
return {
@@ -41,6 +50,8 @@ export default {
} catch (e) {
// ignore
}
// 底部 tab 等场景下页面会被缓存,子组件 mounted 不会再次执行,需每次显示时拉取最新数据
this.refreshImplDataIfReady();
},
methods: {
loadSubPackagePagesSubpackage() {
@@ -67,10 +78,23 @@ export default {
try {
await this.loadSubPackagePagesSubpackage();
this.implReady = true;
await this.$nextTick();
this.refreshImplDataIfReady();
} catch (e) {
console.error('[FurnitureReceptionHost] loadImpl failed:', e);
this.error = '接待模块加载失败,请重试';
}
},
refreshImplDataIfReady() {
if (!this.implReady) {
return;
}
this.$nextTick(() => {
const impl = this.$refs.furnitureReceptionImpl;
if (impl && typeof impl.refreshPageData === 'function') {
impl.refreshPageData();
}
});
}
}
};