How to use the vee-validate.Validator.addLocale function in vee-validate

To help you get started, we’ve selected a few vee-validate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SAHX / SAHX-Admin / front / app.js View on Github external
import { sync } from 'vuex-router-sync'
import store from './store/index'
import RouterConfig from './router'
import axios from 'axios'
import api from './lib/api'
import App from './views/index.vue'
import moment from 'moment'
import zh_cn from 'vee-validate/dist/locale/zh_CN'

console.log(moment().format());

Vue.use(api,axios); // 自定义插件, 其内有全局请求属性方法:api (用法:this.$api(url, params, callback)) 和 axios (用法:this.$http.get 或 post)
Vue.use(VueRouter);
Vue.use(Vuex);

Validator.addLocale(zh_cn); // 加载本地化语言文件
Vue.use(VeeValidate,{locale: 'zh_CN'}); // 设置为中文

const router = new VueRouter({base: __dirname, routes:RouterConfig});
sync(store, router);
new Vue({
    el: '#app',
    store,
    router,
    render: h => h(App)
});