// pages/billboards/park/park-category/index.js import { BillboardModel } from '../../../../models/billboard.js' let billboard = new BillboardModel() Page({ /** * 页面的初始数据 */ data: { list: [], curCode: '' // }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { const { code,title } = options wx.setNavigationBarTitle({ title: title, }) console.log(code) this.setData({ curCode: code, }) this.fetchList() }, onTapMoreItem (e) { const {code, name} = e.currentTarget.dataset wx.navigateTo({ url: `/pages/billboards/park/park-detail/index?code=${code}&name=${name}`, }) }, clickCardItem(e) { var id = e.currentTarget.dataset.id wx.navigateTo({ url: '/pages/article/index?id=' + id, }) }, fetchList() { billboard.fetchBailList(this.data.curCode, 1, res => { this.setData({ list: res.list, }) }) }, // 获取分类Tags fetchTags() { wx.showLoading({ title: '加载中...', }) billboard.fetchTagsByCode(this.data.curCode, res => { console.log(res) const categorys = res.result.records this.setData({ list: categorys, }) categorys.forEach((item, index) => { this.fetchList(item.code, index) }) wx.hideLoading() }) }, })