var app = getApp(); Component({ properties: { params: { type: null }, data: { type: null } }, data: { articles: [] }, // 私有数据,可用于模板渲染 lifetimes: { // 生命周期函数,可以为函数,或一个在methods段中定义的方法名 attached() { }, moved() {}, detached() {}, }, // 生命周期函数,可以为函数,或一个在methods段中定义的方法名 attached() { }, // 此处attached的声明会被lifetimes字段中的声明覆盖 ready() { this.getMoreArticle(); }, pageLifetimes: { // 组件所在页面的生命周期函数 show() {}, hide() {}, resize() {}, }, methods: { getMoreArticle() { var that = this; var urlStr = app.getNetAddresss("plugin.article.api.article-page.page"); urlStr += '&pageSize=' + that.data.params.shownum; app._getNetWork({ showToastIn: false, url: urlStr, success: function(resdata) { var res = resdata.data; if (res.result == 1) { that.setData({ articles: res.data.data, }); } }, fail: function(res) { } }); }, gotoArticle(e) { let item = e.currentTarget.dataset.item; wx.navigateTo({ url: '/packageA/member/article/articleContent/articleContent?article_id=' + item.articleid }); }, } });