Vue3数据传递
It has been 703 days since the last update, the content of the article may be outdated.
Vue3数据传递
setup中数据传递相关
组件注册
直接导入即可使用,无需注册
父传子
props
js
1 | defineProps({ |
子传父
emits派发事件
js
1 | let em = defineEmits(['send']) |
ref子传父
在子组件中先暴露
js
1 | let params = '子组件暴露的数据' |
在父组件中获取
js
1 | //获得当前实例,this指向 |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 NobitaYuan!