| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- // index.js
- const { API } = require('../../service/api.js');
- const App = getApp();
- Page({
- data: {
- bannerList: [],
- ipInfoList: [],
- prodClassList: [],
- showAddCartModal: false,
- currentProduct: null
- },
- // 显示商品属性模态框
- showAddCartModal(e) {
- const product = e.detail;
- this.setData({
- showAddCartModal: true,
- currentProduct:product
- });
- },
- // 关闭商品属性模态框
- handleCloseAddCartModal() {
- this.setData({ showAddCartModal: false });
- },
- onLoad: async function (options) {
- // 生命周期函数--监听页面加载
- console.log("onLoad");
- console.log('App.globalData', App.globalData);
- const resBanner = await API.getBanners({});
- console.log('resBanner', resBanner);
- this.setData({
- bannerList : resBanner.bannerList
- });
- const resBrand = await API.getIpInfos({});
- console.log('resBrand', resBrand);
- this.setData({
- ipInfoList : resBrand.ipInfoList
- });
- const resCategory = await API.getProdClasses({});
- console.log('resCategory', resCategory);
- this.setData({
- prodClassList : resCategory.prodClassList
- });
- },
- })
|