组件事件
## 组件事件
<template>
<CurdForm ref="dynamicForm" :form-schema="formSchema"></CurdForm>
</template>
<script setup>
import { ref, getCurrentInstance } from "vue"
const instance = getCurrentInstance()
const formSchema = {
formItem: [
{
type: "input",
label: "姓名",
prop: "name",
span: 24,
eventObject:{
change:(data)=>{
instance.appContext.config.globalProperties.$message({
type: "success",
message: "change事件触发了",
})
},
blur:(data)=>{
instance.appContext.config.globalProperties.$message({
type: "success",
message: "blur事件触发了",
})
},
focus:(data)=>{
instance.appContext.config.globalProperties.$message({
type: "success",
message: "focus事件触发了",
})
},
click:(data)=>{
instance.appContext.config.globalProperties.$message({
type: "success",
message: "click事件触发了",
})
}
}
},
]
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46