1.index.vue
<template>
<view>
<button type="primary" @click="click">传值</button>
</view>
</template>
<script>
export default {
methods: {
click(){
uni.$emit('change',{id:1,name:'张三'})
}
},
}
</script>
2.home.vue
<template>
<view>
我是home
{{title}}
</view>
</template>
<script>
export default {
props:['title'],
data() {
return {
}
},
onLoad() {
uni.$once('change',(data)=>{
console.log(data.id)
})
}
}
</script>