// pages/tabber/news/index.js Page({ /** * 页面的初始数据 */ data: { selectInfo: {}, latticelist: [ { num: 1, status: '待收', color: '#FF7300', }, { num: 2, status: '待收', color: '#FF7300', }, { num: 3, status: '已存', color: '#408FED', }, { num: 4, status: '暂存', color: '#8B5728', }, { num: 5, status: '冻结', color: '#D1011D', }, { num: 6, status: '空闲', color: '#55BE19', }, { num: 7, status: '空闲', color: '#55BE19', }, { num: 8, status: '空闲', color: '#55BE19', }, { num: 9, status: '空闲', color: '#55BE19', }, ], state:"", detashow:true, show:true, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { class Select { in = 1 getSelet() { console.log(2); return 10 } } var b = new Select(); console.log(b.getSelet()); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { const query = wx.createSelectorQuery() query.select('#nav').boundingClientRect((res) => { console.log(res); this.setData({ selectInfo: res }) }) query.exec() }, //点击变色 显示按钮 seled:function(e){ this.setData({ state: e.currentTarget.dataset.key, }); }, deta:function(){ if(this.data.detashow){ this.setData({ detashow: false, }); }else{ this.setData({ detashow: true, }); } }, show:function(){ if(this.data.detashow){ this.setData({ show: false, }); }else{ this.setData({ show: true, }); } } })