pages/index/index
<template>
<view class="content">
<navigator url="/pages/test/test?id=1&name=test" hover-class="navigator-hover">
<button type="default">跳转到新页面并传参</button>
</navigator>
<button type="primary" @click="tiaozhuan">跳转到新页面并传参</button>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
tiaozhuan() {
uni.navigateTo({
url: '/pages/test/test?id=2&name=test2'
})
}
}
}
</script>
<style>
/* #ifdef H5 */
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: #007AFF
}
/* #endif */
/* #ifdef MP-WEIXIN */
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: #4CD964
}
/* #endif */
</style>
/pages/test/test
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
},
onLoad(options) {
console.log(options)
}
}
</script>
<style>
</style>