场景:新增数据后刷新Table
方法:
子组件代码:
- 在子组件中使用emit引用父组件的方法
const emit = defineEmits({
'refrashTable': null
})
- 调用该方法
const refrashTable = () => {
emit("refrashTable")
}
很方便,先引用再直接调用
vue3 setup语法糖,子组件调用父组件方法
阅读 173
2022-04-13
子组件代码:
const emit = defineEmits({
'refrashTable': null
})
const refrashTable = () => {
emit("refrashTable")
}
很方便,先引用再直接调用
相关推荐
精彩评论(0)