-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v-on
modifier .once
triggers handler at most once... per what?
#3033
Comments
@nekomachi-touge The confusion about "mount," "update," or "lifecycle" phases doesn't apply directly here. The <template>
<button @click.once="handleClick">Click Me</button>
</template>
<script setup>
function handleClick() {
console.log('Button clicked');
}
</script> In this case, the handleClick function will only run once, regardless of how many times the button is clicked, because the event listener is removed after the first trigger. Note: check line docs/src/api/built-in-directives.md#178 for the Argument. |
@mahmudunnabikajal |
@nekomachi-touge |
@mahmudunnabikajal Maybe there is a misunderstanding. |
I understand your issue. It will review by a admin. Thanks ❤️ |
docs/src/api/built-in-directives.md
Line 187 in a961225
I found the statement above unclear, because this could imply the listener would be called once per:
This could lead readers to assume the semantics or simply avoid using this modifier not to cause confusion.
The text was updated successfully, but these errors were encountered: