AdaKing88
2023-08-23 9cad48db6c56c3e2796a9d6da881817ef13b6eca
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
<template>
    <el-input 
    v-model="value" 
    type="textarea" 
    debounce
    :rows="data.rows || 5" 
    :disabled="form_disabled[data.prop]" 
    :style="`width: ${data.width || '100%'}`" 
    :placeholder="data.placeholder" 
    @change="handlerChange"
    />
</template>
 
<script>
import { reactive, toRefs } from 'vue';
export default {
    name: "TextareaComponent",
    props: {
        data: {
            type: Object,
            default: () => ({})
        },
        value: {
            type: String,
            default: ''
        }
    },
    emits: ['update:value', 'callback'],
    setup(props, { emit }){
        const data = reactive({
            value: '',
            data: props.data
        })
        
        const handlerChange = (val) => {
            emit("update:value", val)
        }
        return {
            ...toRefs(data),
            handlerChange
        }
    }
}
</script>