Signed-off-by: chy <chy@163.com>
This commit is contained in:
40
src/components/CustomControl/CustomTest.vue
Normal file
40
src/components/CustomControl/CustomTest.vue
Normal file
@@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<!-- 自定义控件例子 -->
|
||||
<div>测试控件,值:{{ textModel }} </div>
|
||||
<div>自定义属性1:{{ custom1 }} </div>
|
||||
<div>自定义属性2:{{ custom2 }} </div>
|
||||
<avue-input v-model="textModel"></avue-input>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineOptions({ name: 'CustomTest' })
|
||||
|
||||
interface Props {
|
||||
prop: string
|
||||
size: string
|
||||
modelValue: string
|
||||
column: Object
|
||||
disabled?: boolean
|
||||
scope?: object
|
||||
custom1?: Object
|
||||
custom2?: Object
|
||||
}
|
||||
const props = defineProps<Props>()
|
||||
const textModel = defineModel<string>()
|
||||
|
||||
watch(
|
||||
() => textModel.value,
|
||||
(value: string) => {
|
||||
const changeObj = {
|
||||
value,
|
||||
column: props.column,
|
||||
row: props.scope?.['row'],
|
||||
index: props.scope?.['index']
|
||||
}
|
||||
if (props.column['change']) props.column['change'](changeObj.value)
|
||||
}
|
||||
)
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
Reference in New Issue
Block a user