Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问支持vuejs 2.0么?运行了一下,提示错误 #4

Open
wanlxp opened this issue Jan 1, 2017 · 3 comments
Open

请问支持vuejs 2.0么?运行了一下,提示错误 #4

wanlxp opened this issue Jan 1, 2017 · 3 comments

Comments

@wanlxp
Copy link

wanlxp commented Jan 1, 2017

请问支持vuejs 2.0么?运行了一下,提示错误:vue-form-validator:
Uncaught TypeError: Cannot read property 'vm' of undefined

VueValidator.install = function(Vue) {

Vue.directive('validator', {

    /**
     * 初始化验证规则
     */
    bind: function() {

        console.log(this)
        var vm = this.vm,           //directive所属viewmodel
            form = this.el,         //directive所在的表单
            NS = this.expression,   //validator 实例的 Namespace
            modelMap = {};          //model -> item 的对应
@webzhao
Copy link
Owner

webzhao commented Jan 3, 2017

由于实现方式的原因,不能支持 Vue.js 2.0。

@howareyouo
Copy link

howareyouo commented Jan 9, 2017

有打算更新么, 这么多验证框架还是觉得这种写法舒服一点..., 如果没有思路的话, 参考一下 https://github.com/logaretm/vee-validate
和这个类似 , 但是验证写法太麻烦了,不是很简洁, 还要自己写错误提示, 有点小不爽...

@webzhao
Copy link
Owner

webzhao commented Jan 10, 2017

目前的这种实现方式,依赖 Vue.js 1.0 中的一些私有 API。但是这些 API 在 2.0 里面去掉了,导致无法基于 2.0 去实现这样的功能。

现在我使用另外一种思路去做了表单验证这一块:https://75team-biz.github.io/v-tags/#/input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants