72 lines
1.5 KiB
JavaScript
72 lines
1.5 KiB
JavaScript
// vueform.config.(js|ts)
|
|
|
|
import customPlugin from '@customPlugin'
|
|
import { defineConfig, Validator } from '@vueform/vueform'
|
|
import bootstrap from '@vueform/vueform/dist/bootstrap'
|
|
import en from '@vueform/vueform/locales/en'
|
|
en.validation.required = 'Please choose atleast one option'
|
|
en.validation.validateCheckbox = 'Please choose atleast one option'
|
|
en.validation.validateRadio = 'Please select an option'
|
|
en.validation.validateTextBox = 'Please fill in this field'
|
|
en.validation.validateTextArea = 'Please provide some details'
|
|
const validateCheckbox = class extends Validator {
|
|
check(value) {
|
|
console.log("value",value);
|
|
if (!value) {
|
|
return false;
|
|
}else{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
const validateRadio = class extends Validator {
|
|
|
|
check(value) {
|
|
console.log("value",value);
|
|
if (!value) {
|
|
return false;
|
|
}else{
|
|
return true;
|
|
}
|
|
|
|
}
|
|
}
|
|
const validateTextBox = class extends Validator {
|
|
|
|
check(value) {
|
|
console.log("value",value);
|
|
if (!value) {
|
|
return false;
|
|
}else{
|
|
return true;
|
|
}
|
|
|
|
}
|
|
}
|
|
const validateTextArea = class extends Validator {
|
|
|
|
check(value) {
|
|
console.log("value",value);
|
|
if (!value) {
|
|
return false;
|
|
}else{
|
|
return true;
|
|
}
|
|
|
|
}
|
|
}
|
|
export default defineConfig({
|
|
rules: {
|
|
validateCheckbox,
|
|
validateRadio,
|
|
validateTextBox,
|
|
validateTextArea
|
|
},
|
|
plugins: [
|
|
customPlugin,
|
|
],
|
|
theme: bootstrap,
|
|
locales: { en },
|
|
locale: 'en',
|
|
})
|