test page
<template>
<view>
test page
<button @click="goPage">跳转</button>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
goPage() {
uni.navigateTo({
url: '/pages/test2/test2',
success: () => {
uni.$emit('resultData', { data: 'data' })
}
})
}
}
}
</script>
<style>
</style>
test2 page
<template>
<view>
test2 page
</view>
</template>
<script>
export default {
data() {
return {
}
},
onLoad() {
uni.$once('resultData', (data) => {
console.log(data)
})
},
methods: {
}
}
</script>
<style>
</style>
gzxd (作者)
懂了
2023-03-04 09:11