You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.6 KiB
65 lines
1.6 KiB
Page({
|
|
data: {
|
|
list:[],
|
|
children:[],
|
|
codeList:[]
|
|
},
|
|
// 在生命周期函数中加载数据
|
|
onLoad(options) {
|
|
// wx.showToast({
|
|
// title: `点击了子项 ${options.name}`,
|
|
// icon: 'none'
|
|
// });
|
|
const s = options.name;
|
|
wx.request({
|
|
url: 'https://keytest.aik518.com/prod-api/work_key/obd/zk_key/type_blue?blueName='+s,
|
|
method: 'GET', // 请求方法
|
|
success: res => {
|
|
this.setData({
|
|
children:res.data.data[0].children
|
|
// list: res.data.map(item => ({
|
|
// ...item,
|
|
// isExpanded: false,
|
|
// bgColor: '#fff'
|
|
// }))
|
|
})
|
|
}
|
|
})
|
|
}
|
|
,
|
|
onShareAppMessage() {
|
|
return {
|
|
title: 'OBD小程序',
|
|
path: '/pages/index/index'
|
|
};
|
|
}
|
|
,
|
|
|
|
refresh: function(e) {
|
|
let id = e.currentTarget.dataset;
|
|
wx.navigateTo({
|
|
url: '/pages/newdetail/newdetail?id=1&name=example'
|
|
});
|
|
},
|
|
// 点击事件处理函数
|
|
handleItemClick: function (e) {
|
|
// const index = e.currentTarget.dataset.index; // 主列表索引
|
|
// const subIndex = e.currentTarget.dataset.subIndex; // 子列表索引
|
|
// const subItem = this.data.list[index].sublist[subIndex];
|
|
// wx.showToast({ title: `点击了 ${subItem.name}`, icon: 'none' });
|
|
const dataid = e.currentTarget.dataset.id;
|
|
// const {parentIndex, childIndex} = e.currentTarget.dataset
|
|
// const childData = this.data.list[parentIndex].children[childIndex]
|
|
// const childId = e.currentTarget.dataset.child;
|
|
|
|
wx.navigateTo({
|
|
url: '/pages/newdetail/newdetail?name='+dataid // 支持参数传递
|
|
})
|
|
// wx.showToast({
|
|
// title: `点击了子项 ${dataid}`,
|
|
// icon: 'none'
|
|
// });
|
|
},
|
|
|
|
|
|
})
|