wx.navigateTo({
url: 'test?id=1'
})
1
2
3
Page({
onLoad: function(option){
console.log(option.query)
}
})
1
2
3
4
5
我在mpvue中写法
export function getQuery() {
/* 获取当前路由栈数组 */
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
const options = currentPage.options
return options
}
1
2
3
4
5
6
7
// 原始页面
methods: {
goDetail() {
wx.navigateTo({
url: '/pages/active/detail?name=曹天骄&sex=男'
})
}
}
1
2
3
4
5
6
7
8
// 跳转后页面
mounted() {
console.log(getQuery())
},