vue3使用ts开发自定义组件,对外开放方法
在script最后使用
C# 全选
defineExpose({
showCreate,
showView,
showEdit
})
使用:
HTML 全选
<data-edit ref="editRef" @on-create="onSuccessCreate" @on-update="onSuccessUpdate"></data-edit>
JavaScript 全选
import DataEdit from './drawer-edit.vue'
const editRef = ref<InstanceType<typeof DataEdit>>()
/**
* 新增
*/
const onClickAdd = () => {
editRef.value?.showCreate()
}
版权声明:本文为YES开发框架网发布内容,转载请附上原文出处连接
YESWEB 张国生