Localization “验证本地化”;财产';地点';不存在于类型';验证器'&引用;
我使用的是VeeValidate,非常适合英语(默认设置) 然而,如果我尝试使用任何其他语言,我会得到一个错误,说 “类型“Validator”上不存在属性“locale”。” 这是我的密码:Localization “验证本地化”;财产';地点';不存在于类型';验证器'&引用;,localization,vue.js,Localization,Vue.js,我使用的是VeeValidate,非常适合英语(默认设置) 然而,如果我尝试使用任何其他语言,我会得到一个错误,说 “类型“Validator”上不存在属性“locale”。” 这是我的密码: import VeeValidate from 'vee-validate'; import french from 'vee-validate/dist/locale/fr'; Vue.use(VeeValidate); @Component export default class TestTes
import VeeValidate from 'vee-validate';
import french from 'vee-validate/dist/locale/fr';
Vue.use(VeeValidate);
@Component
export default class TestTest extends Vue {
locale: any; // I have tried locale: string='fr';
nextLocale() {
return this.locale === 'en' ? 'French' : 'English';
}
changeLocale() {
this.locale = this.$validator.locale === 'fr' ? 'en' : 'fr';
this.$validator.setLocale(this.locale);
}
created() {
this.$validator.updateDictionary({
fr: {
messages: french.messages,
}
})
}
// other none related code...
}
根据:要动态更改组件中的区域设置,必须像这样调用localize
this.$validator.localize('fr', french)
它应该可以正常工作(您不需要调用updateDictionary,因为上面的调用已经在这样做了)根据:要动态更改组件中的区域设置,必须像这样调用localize
this.$validator.localize('fr', french)
而且它应该工作得很好(您不需要调用updateDictionary,因为上面的调用已经在这样做了)在我看来,它是在中定义的。您使用的是不同的版本吗?刚刚更新到最新版本,仍然相同@在我看来,它是在。您使用的是不同的版本吗?刚刚更新到最新版本,仍然相同@伯特