我在一个项目中使用Vutify v-date-picker
,代码工作正常,但我在使用v-model
时有一个打字错误:
<v-date-picker title="Start Date" width = "200" v-model="workingDate" @click:save="newDate"/>
错误是:
Type '{ toString: () => string; toDateString: () => string; toTimeString: () => string; toLocaleString: { (): string; (locales?: string | string[] | undefined, options?: DateTimeFormatOptions | undefined): string; (locales?: LocalesArgument, options?: DateTimeFormatOptions | undefined): string; }; ... 39 more ...; [Symbol...' is not assignable to type 'any[]'.ts(2322)
index.d.mts(2757, 13): The expected type comes from property 'modelValue' which is declared here on type '{ header?: string | undefined; style?: StyleValue | undefined; title?: string | undefined; inputMode?: "calendar" | "keyboard" | undefined; multiple?: boolean | undefined; ... 57 more ...; "onClick:save"?: (() => any) | undefined; } & Record<...>'
我已经上传了一个工作演示,其中也显示了TS错误,在Vuetify playgound.
有一个可能的解决方案here,但它需要访问组件代码,而我没有v-date-picker
的组件代码.