// pages/com_search/com_search.js Page({ /** * 页面的初始数据 */ data: { resultList: [] }, searchTo(){ wx.navigateTo({ url: '../../pages/search/search', }) }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { var data = JSON.parse(decodeURIComponent(options.comList)) console.log(data); this.setData({ resultList: data }) }, //推荐商品传递数据 detailTo(e) { console.log(e.currentTarget.dataset); const id = e.currentTarget.dataset.id; const title = e.currentTarget.dataset.title; const price = e.currentTarget.dataset.price; const comImg = e.currentTarget.dataset.pic; wx.navigateTo({ url: '/pages/details/details?id=' + id + '&title=' + title + '&price=' + price + '&img=' + comImg, }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })