kazupon / vue-validator

:white_check_mark: Validator component for Vue.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vue-validator3.0.0-alpha.1 for vue2.0.3

xiyangjun opened this issue · comments

[Vue warn]: Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option.
(found in root instance)

el:

     <validator name="validation" @valid="onValid" @invalid="onInvalid">
           <div class="alert alert-danger" v-show="errorMsg" v-html="errorMsg"></div>
            <form class="form-horizontal" id="data-panel-form"></form>
      </validator>
commented

Did you installed the plugin?

import Vue from 'vue';
import VueValidator from 'vue-validator';

Vue.use(VueValidator);

@sqal yes, I did this。

validator custom element is deprecated for 3.0
You need to use validity wrap component.
See the example:
https://github.com/vuejs/vue-validator/blob/dev/examples/started/index.html

If you want to manage the validation results of validity wrap component, you need to use the validationwrap component.
See the example:
https://github.com/vuejs/vue-validator/blob/dev/examples/validation/index.html

no 3.0 document. 好难用。

Hey I've tried that with the current alpha.1 version but I always get this:

[Vue warn]: Unknown custom element: <validity> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

Even though I've installed the plugin as described:

import Vue from 'vue'
import VueValidator from 'vue-validator'
Vue.use(VueValidator)

You can use vee-validate.It can used for vuejs2.0.3.

But I can also use vue-validator soon I hope

hm I've found out that for some odd reason the index.js isn't the one that is tagged as alpha.1 in github. I don't know exactly why.

This is what I get from a yarn install

/* @flow */
import { warn } from './util'
import Config from './config'
import Asset from './asset'

function plugin (Vue: GlobalAPI, options: Object = {}) {
  if (plugin.installed) {
    warn('already installed.')
    return
  }

  Config(Vue)
  Asset(Vue)
}

plugin.version = '3.0.0-alpha.1'

export default plugin

if (typeof window !== 'undefined' && window.Vue) {
  window.Vue.use(plugin)
}

The components won't get installed with this script.

UPDATE:
npm install will solve the issue. yarn has probably cached a version that I have downloaded from github directly.