首页 新闻 会员 周边 捐助

vue2.0中使用vee-validate报错

0
悬赏园豆:5 [已解决问题] 解决于 2017-05-31 14:16
//入口文件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的目录下了
显示页面:

 

谢谢各位的帮忙!报错信息

皮皮聪的主页 皮皮聪 | 初学一级 | 园豆:197
提问于:2017-05-19 15:06
< >
分享
最佳答案
0

import messages from 'assets/js/zh_CN'

---->

import messages from './assets/js/zh_CN'

收获园豆:5
czd890 | 专家六级 |园豆:14488 | 2017-05-19 15:10
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册