[Vue warn]: Error in render function: "TypeError: undefined is not an object (evaluating '_vm.errors.has')
See original GitHub issueVersions:
- VueJs: ^2.3.3
- Vee-Validate: ^2.0.0-rc.3
Description:
While running the tests, I’m getting a warning, followed by a stack trace: [Vue warn]: Error in render function: "TypeError: undefined is not an object (evaluating ‘_vm.errors.has’)
found in —> <Hello> at /src/components/Hello.vue <Root>’
Since that above warning, test getting failed Hello.vue _ should render correct contents undefined is not a function (evaluating ‘vm.$el.querySelector(’.hello h1’)') webpack:///test/unit/specs/Hello.spec.js:8:32 <- index.js:10430:32 PhantomJS 2.1.1 (Linux 0.0.0): Executed 1 of 1 (1 FAILED) ERROR (0.069 secs / 0.005 secs)
Steps To Reproduce:
step1: vue init webpack sample-veevalidation step2: cd sample-veevalidation step3: npm install step4: npm install vee-validate --save
step5: add below lines in src/main.js
import VeeValidate from 'vee-validate'
Vue.use(VeeValidate)
step6: add below lines in src/components/Hello.vue
<input v-validate="'required|email'" type="text" name="email">
<span v-show="errors.has('email')">{{ errors.first('email') }}</span>
step7: npm run test
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Okay I found the issue, if you import
vee-validate
and install it instead in therouter/index.js
file it should work correctly. this is very similar to this old issue #11 that only used to happen with Vue 1.0router/index.js
I will try to figure the reason behind it, but the workaround works perfectly.
@logaretm Thank you, your workaround works fine. 😃 Sorry for late reply.