kazupon / vue-validator

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

need support for setting global class prefix #254

Closed aflext closed 8 years ago

aflext commented 8 years ago

I need reset all the default classes like valid invalid touched and so on to have a specific prefix like project-foo- so i can style all of the validation elements with less like

project-foo {
    &-valid{
        border: 1px solid grey;
    };
    &-invalid{
       border: 1px solid red;
    };
}

What i expected is that vue-validator supports syntax like

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

// i want this
VueValidator.setGlobal('classPrefix', 'project-foo-');

Vuex.use(VueValidator);
franciscolourenco commented 8 years ago

I would suggest a way to globally customise classes further. For example:

VueValidator.defaults.classes.invalid = 'error'
VueValidator.defaults.classes.valid = 'good'
kazupon commented 8 years ago

released v3.0.0-alpha.1 https://github.com/vuejs/vue-validator/releases/tag/v3.0.0-alpha.1

We can use the 'Vue.config.validator.classes'. See the example