kazupon / vue-validator

:white_check_mark: Validator component for Vue.js
MIT License
2.19k stars 431 forks source link

An error is always thrown #99

Closed qt911025 closed 8 years ago

qt911025 commented 8 years ago
<!-- head... -->
<body>
<div id="test2">
  <validator name="va">
    <form novalidate>
      <input type="text" v-validate:uname.required/>

    </form>

    <p v-if="$va.uname.required">Uname is required!</p>
  </validator>

</div>
<script src="node_modules/vue/dist/vue.js"></script>
<script src="node_modules/vue-validator/dist/vue-validator.js"></script>
<script src="app.js"></script>
</body>
Vue.config.debug = true;

new Vue({
  el: '#test2'
})

An error "TypeError: scope.$va.uname is undefined" is thrown.

kazupon commented 8 years ago

Thank you for your reporting !!

I've checked your issue code in jsfiddle. However that issue did not occur the error in my environment. Would you tell me the Vue.js version ?

qt911025 commented 8 years ago

It's v1.0.10.

Here's my demo. https://github.com/qt911025/vue-validator-demo

In JSFiddle, there's another problem: https://jsfiddle.net/freugaz2/3/

kazupon commented 8 years ago

Thanks !! This is the bug. I'll try to fix this issue until release v2.0

kazupon commented 8 years ago

Fixed in v2.0-alpha.6

jsfiddle: https://jsfiddle.net/kazupon/7og9hds9/3/

qt911025 commented 8 years ago

Hi, kazupon. Your example works well but I think the problem is not resolved. The error will not be thrown because of the use of minified Vue, from which the debug or error tracking tools(something like that) are removed. The example is still not work in development environment.

https://jsfiddle.net/7og9hds9/18/

I just replaced the minified vue with the raw one. Plz have a check.

kazupon commented 8 years ago

related #35 #103

kazupon commented 8 years ago

Sorry, I cannot find a solution to this issue yet. This issue is difficult.

I'm asking the advise about related issue at below forum.

http://forum.vuejs.org/topic/957/how-to-avoid-evaluating-expression-warning-for-plugin-author

This issue is occuring when we using development version of vue.js

In development of app, we can avoid this issue by setting the Vue.config.warnExpressionErrors = false.

I'll try to write the README.md later. :smile_cat: