You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I often find myself wanting to add shared functionality to my components but the functionality is not specific to the component.
My last example was a validate functionality and I would have loved to so something along those lines:
Basically, it should be called after rendering is done because you still want to manipulate the underlying dom (like a normal directive). However, this type of directive would want access to all props and attrs passed to the component as well so you could easily validate what was passed (in my example).
I really tried hard to hack this into how directives work atm but it's as good as impossible.
A as workaround you would usually do this:
watch(foo,(value)=>{consterror=validator(value)// show error somehow})
But it requires installing loads of watchers / repetitive use of a composable.
A component directive that runs in the scope of the component it was passed on would solve this problem.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I often find myself wanting to add shared functionality to my components but the functionality is not specific to the component.
My last example was a validate functionality and I would have loved to so something along those lines:
Basically, it should be called after rendering is done because you still want to manipulate the underlying dom (like a normal directive). However, this type of directive would want access to all props and attrs passed to the component as well so you could easily validate what was passed (in my example).
I really tried hard to hack this into how directives work atm but it's as good as impossible.
A as workaround you would usually do this:
But it requires installing loads of watchers / repetitive use of a composable.
A component directive that runs in the scope of the component it was passed on would solve this problem.
Beta Was this translation helpful? Give feedback.
All reactions