From 30268ecdf4dc021e1783de8784a8998c068c785c Mon Sep 17 00:00:00 2001 From: Ge Hao Date: Wed, 19 Oct 2016 10:52:47 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=BA=95=E9=83=A8=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E9=A2=9C=E8=89=B2=EF=BC=8CgetCategory=20=E8=BF=98?= =?UTF-8?q?=E6=98=AF=E4=BD=BF=E7=94=A8=E6=96=B0=E7=9A=84=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 因为只能 更新数据,而首页渲染的格式已经定了 --- app.json | 2 +- pages/category/category.js | 8 ++++++-- pages/category/category.json | 0 pages/category/category.wxml | 4 +++- 4 files changed, 10 insertions(+), 4 deletions(-) delete mode 100644 pages/category/category.json diff --git a/app.json b/app.json index cd051db..df389b6 100644 --- a/app.json +++ b/app.json @@ -16,7 +16,7 @@ }, "tabBar": { "color": "#dddddd", - "selectedColor": "#3cc51f", + "selectedColor": "#BF8600", "borderStyle": "white", "backgroundColor": "#323232", "list": [{ diff --git a/pages/category/category.js b/pages/category/category.js index 54eeb41..698a6f6 100644 --- a/pages/category/category.js +++ b/pages/category/category.js @@ -12,11 +12,15 @@ Page({ }) product.getCategories(params.type).then(function(result) { var data = getApp().store.sync(result.data) - that.setData({'items': data}) + that.setData({items: data}) wx.setStorage({ - key:`cate_${params.type}`, + key: `cate_${params.type}`, data: data }) + }, function(fail) { + var key = `cate_${params.type}` + var data = wx.getStorage(key) + wx.setData({items: data}) }) } }) diff --git a/pages/category/category.json b/pages/category/category.json deleted file mode 100644 index e69de29..0000000 diff --git a/pages/category/category.wxml b/pages/category/category.wxml index 24f0147..f52ad6e 100644 --- a/pages/category/category.wxml +++ b/pages/category/category.wxml @@ -1,5 +1,7 @@ - + + + \ No newline at end of file