onLoad: function (t) { var o = t.cid || "", d = parseInt(t.storeid || 0), s = t.keyword || "", i = t.productIds || ""; this.setData({ keyword: categoryid: o, storeid: d, productIds: i }), this.productlist = this.selectComponent("productlist"), this.data.productIds && this.productlist.loadData(!1); }, onShareAppMessage: function (a) { var a = keyword; return { title: '分享', path: “pages/productsearch/productsearch?keyword=”+keyword,
设置正确的分享链接带搜索参数,
onload生命周期中options有搜索参数,就直接调用搜索接口方法即可
onLoad: function (t) {
var o = t.cid || "", d = parseInt(t.storeid || 0), s = t.keyword || "", i = t.productIds || "";
this.setData({
keyword:
categoryid: o,
storeid: d,
productIds: i
}), this.productlist = this.selectComponent("productlist"), this.data.productIds && this.productlist.loadData(!1);
},
onShareAppMessage: function (a) {
var a = keyword;
return {
title: '分享',
path: “pages/productsearch/productsearch?keyword=”+keyword,
}
这个应该属于业务逻辑把,你可以检查下分享的卡片路由上有没有传搜索词(记得encode编码),点击卡片进入也检查下路由上搜索词是否携带,如果是卡片进入这种情况,直接调你们搜索的接口应该就行了