diff --git a/pages.json b/pages.json index 3775699..1a23d3c 100644 --- a/pages.json +++ b/pages.json @@ -1,10 +1,10 @@ { "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages { - "path": "pages/market/index" - // "style": { - // "navigationBarTitleText": "首页" - // } + "path": "pages/market/index", + "style": { + "enablePullDownRefresh": true + } }, { "path": "pages/market/newsDetails", "style": { @@ -88,4 +88,4 @@ "navigationBarBackgroundColor": "#ffffff", "backgroundColor": "#ffffff" } -} +} \ No newline at end of file diff --git a/pages/market/index.vue b/pages/market/index.vue index 0d432d2..e65caef 100644 --- a/pages/market/index.vue +++ b/pages/market/index.vue @@ -4,7 +4,7 @@ + lineHeight="4rpx" lineColor="#cf000d" :current="current" @click="tabChange"> @@ -33,25 +33,18 @@ current: 0, tabList: [{ name: "全部", - key: -1 }, { name: "宏观经济", - key: 0 }, { name: "产业政策", - key: 1 }, { name: "行业动态", - key: 2 }, { name: "友商动态", - key: 3 }, { name: "用户资讯", - key: 4 }, { name: "国际能源", - key: 5 }], NewsList: [], queryParameter: { @@ -66,6 +59,12 @@ onLoad() { this.initData() }, + onPullDownRefresh() { + this.keyword = "" + this.current = 0; + this.initData() + uni.stopPullDownRefresh() + }, methods: { initData() { // this.updateList() @@ -79,32 +78,33 @@ }, search() { console.log("搜索"); - if (this.keyword) { + // if (this.keyword) { this.updateList({ keyword: this.keyword }) - } + // } }, updateList() { let Params if (this.keyword && this.current !== -1) { Params = {keyword: this.keyword,plateName: this.current} - } else if (this.keyword) { + } else if (this.keyword !== "") { Params = {keyword: this.keyword,} - } else if (this.current !== -1) { - Params = {plateName: this.current} + } else if (this.current !== 0) { + Params = {plateName: this.current - 1} } getInfoMarketInformationlist(Params).then(res => { - console.log(res); + // console.log(res); if (res.code === 200) { this.NewsList = res.rows - console.log(this.NewsList); + // console.log(this.NewsList); } }) }, tabChange(e) { console.log(e); - this.current = e.key + this.current = e.index + console.log(this.current); this.updateList() } } @@ -113,4 +113,4 @@ \ No newline at end of file + -- libgit2 0.21.2