最佳答案
您可以创建一个包装器组件和 extends
来自 VTextField
(请参阅 treeshaking )并自定义默认值。
import Vue from 'vue';
import { VTextField } from 'vuetify/lib';
Vue.component('TextFieldOutlined', {
extends: VTextField,
props: {
outlined: {
type: Boolean,
default: true
}
}
})
使用方式如下:
<text-field-outlined
label="Some label"
clearable
dense>
</text-field-outlined>
FWIW,扩展组件意味着所有基础组件的 props 都会被传递,因此同样可用。
关于javascript - 默认情况下,Vuetify 为所有 v-text-field 设置概述,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59894355/