kazupon / vue-validator

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

2.0.0-beta.2 validators this point $validation #170

Closed taoche closed 8 years ago

taoche commented 8 years ago

version -> 2.0.0-beta.2

in example timing project

 validators: {
   confirm: function (val) {
     console.log(this.password)  ->  'undefined' and here this point $validation
     return this.password === val
   }
 },
kazupon commented 8 years ago

ah, sorry ...

You can use the exposed vue instance. https://github.com/vuejs/vue-validator#vm-property

taoche commented 8 years ago

I know this solution, but I want to the future will solve this problem it ?

kazupon commented 8 years ago

In the beta version later, validation function context is not vue instance, but validation instance.

I think that this breaking change is not problem, because it's possible with vm property and el property exposed by vue-validator.

taoche commented 8 years ago

Thank you for your answer