解决微信小程序首页空白问题。

This commit is contained in:
cst61
2026-02-01 09:21:11 +08:00
parent 80d6d46182
commit cc01c4dc47
454 changed files with 404 additions and 62235 deletions

View File

@@ -89,7 +89,12 @@
},
computed: {
uniStarterConfig() {
return getApp().globalData.config
try {
const app = getApp({ allowDefault: true });
return app && app.globalData ? app.globalData.config : {};
} catch (e) {
return {};
}
},
where(){
//拼接where条件 查询条件 ,更多详见 https://uniapp.dcloud.net.cn/uniCloud/unicloud-db?id=jsquery

View File

@@ -113,8 +113,17 @@
cdbRef = this.$refs.udb
},
async onShow() {
this.keyword = getApp().globalData.searchText
getApp().globalData.searchText = ''
try {
const app = getApp({ allowDefault: true });
if (app && app.globalData) {
this.keyword = app.globalData.searchText;
app.globalData.searchText = '';
} else {
this.keyword = '';
}
} catch (e) {
this.keyword = '';
}
//这里仅演示如何在onShow生命周期获取设备位置并在设备或者应用没有权限时自动引导。设置完毕自动重新获取。
//你可以基于他做自己的业务,比如:根据距离由近到远排序列表数据等
// uni.showLoading({

View File

@@ -155,7 +155,12 @@
})
// #endif
this.searchText = getApp().globalData.searchText;
try {
const app = getApp({ allowDefault: true });
this.searchText = app && app.globalData ? app.globalData.searchText : '';
} catch (e) {
this.searchText = '';
}
},
computed: {
associativeShow() {
@@ -298,7 +303,14 @@
this.loadList(item.title);
},
loadList(text = '') {
getApp().globalData.searchText = text;
try {
const app = getApp({ allowDefault: true });
if (app && app.globalData) {
app.globalData.searchText = text;
}
} catch (e) {
// 静默失败
}
uni.switchTab({
url:'/pages/list/list'
})
@@ -318,7 +330,14 @@
})
} else {
this.associativeList.length = 0;
getApp().globalData.searchText = '';
try {
const app = getApp({ allowDefault: true });
if (app && app.globalData) {
app.globalData.searchText = '';
}
} catch (e) {
// 静默失败
}
}
}, 100)
}