vue3 defineEmits的用法

import { defineEmits } from 'vue'
 //定义emit 类型
interface EmitsType {
(e: 'bClick', item: {name:string,age:number}): void
}

const emit = defineEmits<EmitsType>()
const bClick = (item: {name:string,age:number}): void => {
emit('bClick', item)
}
posted @ 2023-05-29 18:11  程序媛小仙女  阅读(934)  评论(0编辑  收藏  举报