怎么点击图标,上方方框展示信息?目前点击事件可以实现
//index.js
//获取应用实例
const app = getApp()
let api = require('../../config/api');
const data = require('../../config/data.js')
Page({
data: {
height:app.globalData.height*2+90,
swipers:['swiper1','swiper2','swiper3'],
active:0,
plist:[],
serverPath:api.ApiRootUrl,
page:1,
text: "你好",
onOff: false
},
btnclick:function(){
console.log('123');
var onOff = this.data.onOff;
this.setData({text:"hello",onOff:!onOff});
},
//事件处理函数
bindViewTap: function() {
wx.navigateTo({
url: '../logs/logs'
})
},
onLoad: function () {
// wx.request({
// url: api.GoodsList,
// success:(res)=>{
// // console.log(res)
// let plist = res.data.productlist;
// plist.forEach((item,i)=>{
// item.imgs = JSON.parse(item.imgs)
// })
// console.log(plist)
// this.setData({
// plist:plist
// })
// }
// })
console.log(data.tuijian)
this.setData({
plist:data.tuijian
})
},
tapName(e){
console.log(e)
wx.navigateTo({
url: '/pages/gengduo/gengduo',
})
},
onChange(event) {
// event.detail 的值为当前选中项的索引
console.log(event.detail)
//this.setData({ active: event.detail });
switch(event.detail){
case 0:
wx.navigateTo({
url: '/pages/index/index',
})
break;
case 1:
wx.navigateTo({
url: '/pages/zixun/zixun',
})
break;
case 2:
wx.navigateTo({
url: '/pages/chuanda/chuanda',
})
break;
case 3:
wx.navigateTo({
url: '/pages/mine/mine',
})
break;
}
},
reachBottom(){
console.log('到达底部')
this.page++;
wx.request({
url:"http://localhost:9529/",
// url: api.GoodsList,
success:(res)=>{
let plist = res.data.productlist;
plist.forEach((item,i)=>{
item.imgs = JSON.parse(item.imgs)
})
plist = this.data.plist.concat(plist)
console.log(plist)
this.setData({
plist:plist
})
}
})
},
goBack(){
wx.navigateBack()
}
})
wxml: