123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <template>
- <el-input
- v-model="value"
- :placeholder="attrs.placeholder?attrs.placeholder:'请输入内容'"
- :maxlength="attrs.maxlength"
- :minlength="attrs.minlength"
- :show-word-limit="attrs.showWordLimit"
- :clearable="attrs.clearable"
- :show-password="attrs.showPassword"
- :disabled="attrs.disabled"
- :size="attrs.size"
- :prefix-icon="attrs.prefixIcon"
- :suffix-icon="attrs.suffixIcon"
- :rows="attrs.rows"
- :readonly="attrs.readonly"
- @input="onChange"
- @clear="onChange"
- ></el-input>
- </template>
- <script lang="ts">
- import { Component, Prop, Vue, Watch } from "vue-property-decorator";
- @Component
- export default class ByInput extends Vue {
- config:any={};
- value:any='';
- @Prop()
- propConfig: any
- @Prop()
- propValue:any
- get attrs(){
- return this.config?.attr ? this.config.attr : {};
- }
- created(){
- if(this.propConfig){
- this.setConfig(this.propConfig)
- }
- if(this.propValue){
- this.setValue(this.propConfig)
- }
- }
- mounted(){
-
- }
- setConfig(c:any){
- if(c){
- this.config = c;
- }
- }
- getConfig(){
- return (this as any).$lodash.cloneDeep(this.config)
- }
- setValue(data:any){
- if(data){
- this.value = (this as any).$lodash.cloneDeep(data);
- }else{
- this.value = {};
- }
- }
- getValue(){
- return (this as any).$lodash.cloneDeep(this.value);
- }
- // 清空数据
- clearValue(){
- this.value = ''
- }
- onChange(){
- this.$emit('onChange',this.value);
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|