Releases: FrontLabsOfficial/vue-tiny-validate
Releases Β· FrontLabsOfficial/vue-tiny-validate
v0.2.4
v0.2.2
- Fix wrong
result
whendata
has multiple nested properties. - Async
$test
method.
await result.$test();
console.log('Tested');
- Cancel async validation on resetting.
- Add more parameters (
data
,rules
,options
) totest
function. Also, updaterule
properties.
const rules = reactive({
name: {
// rule now has (name, test, message) properties instead of ($key, $test, $message) properties
name: 'required',
test: (value, data, rules, options) => {
// you can access data, rules, options here
return Boolean(value);
},
message: 'Name must not be empty.',
},
});
- Support Vue 2.
- Add
transform
option.
v0.2.1
- New
options
parameter. See documentation for more detail. - Support async validate function
const rules = reactive({
name: {
name: 'required',
test: (value) => new Promise(resolve => {
resolve(true);
});
}
})
- Clear entry data (
$error
,$invalid
,$messages
) on resetting.
v0.2.0
- Support
Ref
data andRef
rules.
export default {
setup() {
const data = ref({ name: 'Evelyn' });
const rules = ref({
name: {
name: 'required',
test: value => Boolean(value),
message: 'Name must not be empty.',
},
});
const { result } = useValidate(data, rules);
return { result, data };
},
};