app-preset-text-input.vue 1.2 KB
Newer Older
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
<template>
    <div class="app-text-input">
        <el-input v-model="curValue" :placeholder="placeholder"></el-input>
    </div>
</template>

<script lang="ts">
import { Vue, Component, Prop } from 'vue-property-decorator';

@Component({})
export default class AppPresetTextInput extends Vue {
    /**
     * 输入值
     *
     * @type {*}
     * @memberof AppTextInput
     */
    @Prop() public value!: any;

    /**
     * 名称
     *
     * @type {string}
     * @memberof AppTextInput
     */
    @Prop() public name!: string;

    /**
     * 禁用
     *
     * @type {boolean}
     * @memberof AppTextInput
     */
    @Prop() public disabled?: boolean;

    /**
     * 占位文本
     *
     * @type {string}
     * @memberof AppTextInput
     */
    @Prop({default: ''}) public placeholder?: string;

    /**
     * 当前值
     *
     * @memberof AppTextInput
     */
    get curValue() {
        return this.value;
    }

    /**
     * 值变化
     *
     * @memberof AppTextInput
     */
    set curValue(val: any) {
        this.$emit('valueChange', { name: this.name, value: val });
    }
}
</script>

<style lang='less'>
@import './app-preset-text-input.less';
</style>