//入口文件The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import VeeValidate, { Validator } from 'vee-validate'
Vue.use(VeeValidate)
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
template: '<App/>',
components: { App }
})
import messages from 'assets/js/zh_CN'
Validator.updateDictionary({
zh_CN: {
messages
}
})
const config = {
name: 'errors',
delay: 0,
locale: 'zh_CN',
messages: null,
strict: true
}
Vue.use(VeeValidate, config)
const validator = new Validator()
validator.attach('name', 'required|alpha', 'Full Name')// attach field with display name for error generation.
validator.detach('email')
//显示页面
<template>
<div id="login">
<h1>Login</h1>
<form method="post" action="" novalidate>
<input type="text" placeholder="用户名" name="name" v-validate data-rules="required|email" :class="{'input':true,'is-danger':errors.has('name')}"></input>
<span v-show="errors.has('name')" class="help is-danger">{{ errors.first('email')}}</span>
<input type="password" placeholder="密码" v-model="password" name="password"></input>
<button class="but finished" @click="login">登录</button>
</form>
<hello></hello>
</div>
</template>
报错信息:
但实质上我把依赖里面的zh_CN包拷贝到了assets/js/zh_CN的目录下了
显示页面:
谢谢各位的帮忙!
import messages from 'assets/js/zh_CN'
---->
import messages from './assets/js/zh_CN'