From c61c7aae5e596dda2a71d2294a19382e0ffd1002 Mon Sep 17 00:00:00 2001 From: devil Date: Mon, 14 Sep 2020 23:21:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E5=AF=BC=E8=88=AA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weixin/components/quick-nav/quick-nav.js | 32 +++++++++++++++++-- .../components/quick-nav/quick-nav.wxml | 4 +-- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/sourcecode/weixin/components/quick-nav/quick-nav.js b/sourcecode/weixin/components/quick-nav/quick-nav.js index dd49fd4c0..e029e40f0 100644 --- a/sourcecode/weixin/components/quick-nav/quick-nav.js +++ b/sourcecode/weixin/components/quick-nav/quick-nav.js @@ -2,13 +2,39 @@ const app = getApp(); Component({ data: { popup_status: false, - data: [], + data_list: [], + is_first: 1, + }, + pageLifetimes: { + // 页面被展示 + show: function() { + this.init_config(); + + // 非首次进入则校验数据,无数据则重新初始化配置接口 + if(this.data.is_first == 0) { + var data = app.get_config('quick_nav') || []; + if(data.length <= 0) { + app.init_config(); + } + } + + // 首次初始化状态 + this.setData({ is_first: 0 }); + }, }, methods: { + // 初始化配置 + init_config(status) { + if((status || false) == true) { + this.setData({ data_list: app.get_config('quick_nav') || [] }); + } else { + app.is_config(this, 'init_config'); + } + }, + // 弹层开启 quick_open_event(e) { - var data = app.get_config('quick_nav') || []; - this.setData({ popup_status: true, data: data }); + this.setData({popup_status: true, data_list: app.get_config('quick_nav') || []}); }, // 弹层关闭 diff --git a/sourcecode/weixin/components/quick-nav/quick-nav.wxml b/sourcecode/weixin/components/quick-nav/quick-nav.wxml index 96615d204..cf348f056 100644 --- a/sourcecode/weixin/components/quick-nav/quick-nav.wxml +++ b/sourcecode/weixin/components/quick-nav/quick-nav.wxml @@ -12,8 +12,8 @@ - - + +