【发布时间】:2021-12-15 06:06:00
【问题描述】:
我想像这样制作默认输入的自定义输入组件。
<template>
<input type="text">
</template>
<script>
export default {
name: "CustomInput",
}
</script>
我怎样才能添加所有默认的道具,没有定义。例如,如果我在 CustomInput 上设置占位符,则此占位符会自动应用于 input 我不需要在组件 CustomInput 中将占位符写为道具。
<CustomInput placeholder="test"/>
//it will be apply like
<input placeholder="test"/>
【问题讨论】:
标签: vue.js vue-component vuejs3