fixed:小程序首页title动态获取miniappName
Showing
4 changed files
with
9 additions
and
9 deletions
@@ -258,6 +258,9 @@ App({ | @@ -258,6 +258,9 @@ App({ | ||
258 | getMiniappType() { | 258 | getMiniappType() { |
259 | return wx.getExtConfigSync().miniappType; | 259 | return wx.getExtConfigSync().miniappType; |
260 | }, | 260 | }, |
261 | + getMiniappName() { | ||
262 | + return wx.getExtConfigSync().miniappName; | ||
263 | + }, | ||
261 | getUnionType() { | 264 | getUnionType() { |
262 | return config.unionType; | 265 | return config.unionType; |
263 | }, | 266 | }, |
@@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
6 | "name": "wechat", | 6 | "name": "wechat", |
7 | "extAppid": "wxe8bfc9b404772199", | 7 | "extAppid": "wxe8bfc9b404772199", |
8 | "miniappType": "5", | 8 | "miniappType": "5", |
9 | + "miniappName": "测试店铺名", | ||
9 | "attr": { | 10 | "attr": { |
10 | "host": "open.weixin.qq.com", | 11 | "host": "open.weixin.qq.com", |
11 | "users": [ | 12 | "users": [ |
@@ -36,6 +36,10 @@ Page({ | @@ -36,6 +36,10 @@ Page({ | ||
36 | onShow: function() { | 36 | onShow: function() { |
37 | const shopId = app.getShopId(); | 37 | const shopId = app.getShopId(); |
38 | 38 | ||
39 | + wx.setNavigationBarTitle({ | ||
40 | + title: app.getMiniappName(), | ||
41 | + }); | ||
42 | + | ||
39 | if (shopId) { | 43 | if (shopId) { |
40 | this.getShopData(shopId); | 44 | this.getShopData(shopId); |
41 | this.getShopProducts(shopId); | 45 | this.getShopProducts(shopId); |
@@ -123,14 +127,6 @@ Page({ | @@ -123,14 +127,6 @@ Page({ | ||
123 | 127 | ||
124 | indexModel.shopInfo(params) | 128 | indexModel.shopInfo(params) |
125 | .then(res => { | 129 | .then(res => { |
126 | - if (res.data.shop_name) { | ||
127 | - let shopName = res.data.shop_name; | ||
128 | - | ||
129 | - wx.setNavigationBarTitle({ | ||
130 | - title: shopName, | ||
131 | - }); | ||
132 | - } | ||
133 | - | ||
134 | let shopInfo = res.data; | 130 | let shopInfo = res.data; |
135 | 131 | ||
136 | this.setData({ | 132 | this.setData({ |
1 | { | 1 | { |
2 | - "navigationBarTitleText": "店铺", | 2 | + "navigationBarTitleText": "", |
3 | "usingComponents": { | 3 | "usingComponents": { |
4 | "resources": "/components/resources/resources", | 4 | "resources": "/components/resources/resources", |
5 | "copyright": "/components/layout/copyright/copyright", | 5 | "copyright": "/components/layout/copyright/copyright", |
-
Please register or login to post a comment