// pages/billboards/policy/policy-list/index.js import { PolicyModel } from '../../../../models/policy.js' let policy = new PolicyModel() Page({ /** * 页面的初始数据 */ data: { navSelectIndex: 0, nodes: '', navs: [], tags: [], // 导航的原始数据 curCode: '' }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { console.log(options) const tags = wx.getStorageSync('PolicyTags') let navs = tags.map(item=> {return item.name}) const {index} = options this.setData({ tags: tags, navSelectIndex: index, navs: navs, curCode: tags[index].code }) this.fetchPolicyArtice() }, tapSegemnt (e) { console.log(e.detail) const index = e.detail.index this.setData({ curCode: this.data.tags[index].code }) this.fetchPolicyArtice() }, fetchPolicyArtice () { policy.fetchPolicyArtice(this.data.curCode, res => { console.log(res) const list = res.list this.setData({ nodes: list[0].content }) }) } })