|
|
@@ -131,13 +131,21 @@ export default {
|
|
|
onShow() {
|
|
|
this.loadInfo()
|
|
|
},
|
|
|
- created() {
|
|
|
- uni.$on('showLoginSheet', function() {
|
|
|
- this.showLoginSheet()
|
|
|
- }.bind(this))
|
|
|
+ onLoad() {
|
|
|
+ // 注册全局登录浮层触发事件(uni-app 页面生命周期 onLoad 早于 created 时机更稳)
|
|
|
+ var self = this
|
|
|
+ try {
|
|
|
+ uni.$on('showLoginSheet', function() {
|
|
|
+ self.showLoginSheet()
|
|
|
+ })
|
|
|
+ } catch (e) {
|
|
|
+ console.error('[home] 注册 showLoginSheet 监听失败', e)
|
|
|
+ }
|
|
|
},
|
|
|
- beforeDestroy() {
|
|
|
- uni.$off('showLoginSheet')
|
|
|
+ onUnload() {
|
|
|
+ try {
|
|
|
+ uni.$off('showLoginSheet')
|
|
|
+ } catch (e) {}
|
|
|
},
|
|
|
methods: {
|
|
|
loadInfo() {
|