use vee-validate to check the form and find that the localization settings in the latest version do not work. Solve
"vee-validate": "^2.1.0-beta.2",
"vue": "^2.5.2",
"vue-i18n": "^8.0.0",
my code is as follows:
create a new validator file specifically to configure the vee-validator plug-in:
import Vue from "vue"
import VeeValidate, {Validator} from "vee-validate"
import VueI18n from "vue-i18n"
import zh from "vee-validate/dist/locale/zh_CN"
Vue.use(VueI18n)
const i18n = new VueI18n({local: "zh_CN"})
Vue.use(VeeValidate, {
i18n,
i18nRootKey: "validations",
aria: true,
inject: true,
local: "zh_cn",
dictionary: {
zh_cn: zh
}
})
const Dictionary = {
zh_CN: {
messages: {
required: field => `${field}`
},
attributes: {
username: ""
}
}
}
Validator.localize(Dictionary)
then introduce
into main.jsimport Vue from "vue"
import App from "./App"
import router from "./router"
import "./libs/validator" // vee-validator
import "normalize.css"
import "./assets/styles/theme.styl"
import "mand-mobile/lib/mand-mobile.css"
import mandMobile from "mand-mobile"
Vue.use(mandMobile)
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: "-sharpapp",
router,
components: { App },
template: "<App/>"
})
but there is no Chinese error prompt in the result
there are no changes on the official website, and now the whole face is confused