如何建手机网站,做同城特价的网站有哪些,企业文化范文,WordPress 分类目录 加斜杠背景#xff1a; 封装一个使用功能相同使用频率较高的input公共组件作为子组件#xff0c;大多数长度要求为200#xff0c;且实时显示统计子数#xff0c;部分input有输入提示。
代码实现如下#xff1a;
templateel-input v-modelinputValue t…背景 封装一个使用功能相同使用频率较高的input公共组件作为子组件大多数长度要求为200且实时显示统计子数部分input有输入提示。
代码实现如下
templateel-input v-modelinputValue typetextarea :maxlengthmaxlength :placeholderplaceholder autosize show-word-limit inputhandleInput/el-input
/templatescript setup langts
const inputValue ref()
interface Props {placeholder: string;maxlength: number;
}
withDefaults(definePropsProps(), {placeholder: ,maxlength: 200,autosize: true,showWordLimit: true,
});const emit defineEmits([update:modelValue]);
const handleInput () {emit(update:modelValue, inputValue.value);
};
/script上面代码实现console控制台就会有warn 所有可传可不传的属性我们都要给加上?,console控制台就没有warn信息。
interface Props {placeholder?: string;maxlength?: number;
}