Comments (4)
Could you please add a reference where have you found it? Creating list of useful examples is on a roadmap for the docs.
from vuelidate.
@mrcha90
Could you please add your solution here.
from vuelidate.
I have found solution in your prev issue. So it's ok.
from vuelidate.
_.debounce
from lodash does not return the result of the debounced function so the validator cannot work.
You could use this debounce
version to make sure every call to the debounced function resolves their promise with the result of the latest call during the interval.
const debounce = (callback, timeout) => {
let timer;
const resolvers = [];
return async (...args) => {
clearTimeout(timer);
return new Promise((resolve) => {
resolvers.push(resolve);
timer = setTimeout(async () => {
const result = await callback.apply(this, args);
resolvers.map((resolver) => resolver(result));
}, timeout);
});
};
};
const rules = {
name: {
test: helpers.withAsync(
debounce(() => {
return false;
}, 1000)
),
$lazy: true,
},
};
from vuelidate.
Related Issues (20)
- unable to import from @vuelidate /core HOT 1
- Issue with async rules HOT 9
- Vuelidate ignore object keys starting with $
- Package path . is not exported from package HOT 1
- How can i translate property ? HOT 1
- .withAsync helper doesn't work within .forEach helper HOT 1
- ValidateEach component using <script setup> not updating v object HOT 7
- Using Vuelidate to validate an array of items has no $touch for array properties only the parent object HOT 1
- Validation replication using best practices
- The validator created for the array becomes invalid even though each of its sub-elements is valid.
- Error messages need improvement HOT 1
- Array of objects optional validation HOT 2
- Array $each validate show invalid when load page HOT 1
- Helpers.ForEach does not work with reactive rules HOT 2
- `$externalResults` won't apply if field does not have at least one client side validator rule defined
- Access component data in helpers.withMessage
- Typo HOT 1
- $error is true even though required is false HOT 3
- feat: add when built-in validator (or helper) HOT 1
- ValidateEach support template refs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vuelidate.