1、我们在主页,点击搜索,跳转到search页面
2、当前这个search页面,input、v-model="keyword"绑定
<input
type="text"
@input="handleInput"
placeholder="搜索商品"
v-model="keyword"
/>
// 搜索商品
handleInput() {
clearTimeout(this.timeId)
this.timeId = setTimeout(() => {
this.page = 1
this.hasMore = true
this.goodsList = []
this.getGoodsList()
}, 1000)
},
3、搜索功能到这里结束,下面是分享
坑来了
let curRoute = routes[routes.length - 1].route;
let curRoute1 = routes[routes.length - 1].$page.fullPath
这两个let,是不对等的,第一个最开始多了 / 符号,如果只是单分享,用2。
如果是分享当前页面搜索后的新数据内容,用1。
否则第一次分享的时候是可以的,第二次分享的时候,分享链接是错误的
4、最后在search接受,分享后的参数