diff --git a/components/cell/index.js b/components/cell/index.js index 6402e4c..5d890d5 100644 --- a/components/cell/index.js +++ b/components/cell/index.js @@ -21,18 +21,10 @@ Component({ value: '' } }, - observers: { - readed (value) { - this.setData({ - _readed: value - }) - } - }, /** * 组件的初始数据 */ data: { - _readed: false, }, /** @@ -40,9 +32,6 @@ Component({ */ methods: { onTap () { - this.setData({ - _readed: true - }) this.triggerEvent('clickListItem', { id: this.properties.cId, index: this.properties.index}) } } diff --git a/components/cell/index.wxml b/components/cell/index.wxml index 22d4902..be65daf 100644 --- a/components/cell/index.wxml +++ b/components/cell/index.wxml @@ -1,7 +1,7 @@ - {{title}} + {{title}} {{time}} diff --git a/pages/article/index.js b/pages/article/index.js index 20949b1..1135b6c 100644 --- a/pages/article/index.js +++ b/pages/article/index.js @@ -51,6 +51,9 @@ Page({ this.fetchArticeApi() }, fetchArticeApi () { + wx.showLoading({ + title: '加载中...', + }) artice.getDetail(this.data.aId, (res) => { //console.log('artice detail') console.log(res) @@ -67,6 +70,8 @@ Page({ disable: data.typeFlag == 3 ? true : false, readNum: data.readNum, collectNum: data.collectNum, + }, () => { + wx.hideLoading() }) }) }, diff --git a/pages/article/index.wxml b/pages/article/index.wxml index 257ca2b..eededd5 100644 --- a/pages/article/index.wxml +++ b/pages/article/index.wxml @@ -21,4 +21,5 @@ + diff --git a/pages/home/index.js b/pages/home/index.js index 1fce43d..6527713 100644 --- a/pages/home/index.js +++ b/pages/home/index.js @@ -26,6 +26,7 @@ Page({ onPullDownRefresh: function () { this.setData({ currPage: 1, + list: [] }) this.fetchHomeList() this.fetchHomeBanner() @@ -88,7 +89,7 @@ Page({ // }) } } - //console.log(res) + console.log(res) wx.stopPullDownRefresh() }) }, @@ -139,6 +140,9 @@ Page({ clickListItem (e) { //console.log(e.detail) const {id, index} = e.detail + this.setData({ + [`list[${index}].readed`]: true + }) this.gotoArticePage(id) }, gotoArticePage (id) { diff --git a/pages/home/index.wxml b/pages/home/index.wxml index c6cb141..1554c48 100644 --- a/pages/home/index.wxml +++ b/pages/home/index.wxml @@ -5,7 +5,7 @@