Page 页面使用
import { ThemeModel } from '../../models/ThemeModel.js';
const themModel = new ThemeModel();
Page({
/**
* 页面的初始数据
*/
data: {
loadingHidden:false,
baseRequestUrl: themModel.getApiBaseUrl()
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.data.id = options.id;
this.data.name = options.name;
this.loadData()
},
onReady() {
// 动态设计页面title
wx.setNavigationBarTitle({
title: this.data.name,
})
},
loadData() {
themModel.get(this.data.id)
.then(res=>{
if(res.code=== 0) {
this.setData({
themeInfo: res.data,
loadingHidden: true
})
}
})
},
// 点击转到取商品详细页面
onProductsItemTap(event) {
var id = event.currentTarget.dataset.id;
wx.navigateTo({
url: '../product/product?id=' + id,
})
},
})