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
-. Some button or elements should track the log rate, while it would not that comfortable if log them in js
<!-- a tweat button in the top -->
<button v-on:click.log='tweat("top")' data-tweat_potision='top'> Tweat </button>
<!-- a tweat button in the bottom -->
<button v-on:click.log='tweat("bottom")' data-tweat_potision='bottom'> Tweat </button>
function tweat(position) {
const logs = {position};
http.post(..., logs);
....
doRealTeatAction();
}
would be simple like to
<!-- a tweat button in the top -->
<button v-on:click.log='tweat()' data-tweat_potision='top'> Tweat </button>
<!-- a tweat button in the bottom -->
<button v-on:click.log='tweat()' data-tweat_potision='bottom'> Tweat </button>
// a global log function for log modifer
function log($event) {
const logs = $event.targetElement.dataset;
http.post(..., logs);
}
The designed usage for modifiers is to limit when the handler should be fired. Your proposed modifiers fall into a different category and IMO makes the concept overloaded just for syntax convenience. Custom behavior that goes beyond firing or not is better done in JavaScript. You can reuse it as a method wrapper/decorator:
What about calling the v-on:click handler only once when the user-specified predicate is set to true. For example call the handler at most once when the form is valid. So I'm actually looking for some kind of parameterized once modifier.
Well my use case would for sure fall into category "limit when the handler should be fired".
So the real question would be: "Are the custom modifiers not an option in the near future?"
If not, I think I'll try to implement a custom directive to avoid code repetition.
What problem does this feature solve?
It would be much helpful if expose the api for adding custom modifiers.
e.g.
-. Some actions must be confirmed before doing the real work.
would be simple like to
-. Some button or elements should track the log rate, while it would not that comfortable if log them in js
would be simple like to
What does the proposed API look like?
The text was updated successfully, but these errors were encountered: