页面1:
function chooseUser() {
uni.navigateTo({
url: '/pages/userList?name=' + schData.value.keyword,
events: {
chooseUser: ({ name, num }) => {
console.log(7878, name, num)
}
}
})
}
//==================================页面分割线====================================
页面2:
import { getCurrentInstance, nextTick, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
const { proxy } = getCurrentInstance()
const eventChannel = ref(null)
onLoad(async options => {
await nextTick()
schData.value.keyword = options.num
eventChannel.value = proxy.getOpenerEventChannel()
})
const chooseItem = item => {
uni.navigateBack()
eventChannel.value.emit('chooseUser', { name: item.userName, num: item.num })
}
uniapp+vue3使用uni.navigateBack传值,uni.navigateTo接收值
最新推荐文章于 2025-02-25 14:26:57 发布