vue3 + ts环境中props配置自定义类型
使用:
JavaScript 全选
Object as PropType<PopConfirmOptionType>
JavaScript 全选
interface PopConfirmOptionType {
title: string,
confirmButtonText: string,
cancelButtonText: string
}
// 传递给ElButton组件的属性
const props = defineProps({
customClass: {
type: String,
default: ''
},
sync: {
type: Boolean,
default: false,
},
usePopConfirm: {
type: Boolean,
default: false,
},
popConfirmOptions: {
type: Object as PropType<PopConfirmOptionType>,
default: () => {
return {
title: "",
confirmButtonText: "确定",
cancelButtonText: "取消"
}
}
}
});
版权声明:本文为YES开发框架网发布内容,转载请附上原文出处连接
post 张国生