// pages/search-details/earch-details.js Page({ /** * 页面的初始数据 */ data: { }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { console.log(options) var that=this const sr=options.sr console.log(sr) if (sr == 1){ that.setData({ tex:"白菜\n", texx:" 白菜(学名:Brassica pekinensis (Lour.) Rupr. ) \n是十字花科,芸苔属二年生草本。" }) } else if (sr ==2){ that.setData({ tex:"青椒\n", texx:"青椒为植物界,双子叶植物纲,合瓣花亚纲,茄科。 \n和红色辣椒统称为辣椒。果实为浆果。" }) } else if (sr == 3){ that.setData({ tex:"黄瓜\n", texx:"黄瓜(学名:Cucumis sativus L.)葫芦科一年生蔓生或攀援草本植物。\n茎、枝伸长,有棱沟,被白色的糙硬毛。卷须细。" }) } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function (options) { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ // onShareAppMessage: function () { // } })