-
Notifications
You must be signed in to change notification settings - Fork 14
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
Не обновляется обработчик события на DOM узле при ререндере #1322
Comments
Потенциально проблема очень серьезная, так как если изначально у узла нет патч флагов и это не компонент, то такой узел отслеживаться не будет (при условии, что он внутри блока). |
Fixed in #1323 |
This was referenced Jul 10, 2024
Open
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Vue может переиспользовать существующие DOM узлы при ререндере. Если на DOM узле, уже есть обработчик (el._vei), то Vue обновит его проставив ссылку на новую функцию, при этом addEventListener использоваться не будет.
В некоторых случаях vnode узлы генерируются с флагом 32 (HYDRATE_EVENTS), в этом случае Vue не добавит vnode как динамический:
Мы со своей стороны для vnode задаем проп data-has-v-on-directives, и в patchFlag дописываем 8 (PROPS), однако, так как при создании vnode в createBaseVNode в currentBlock узел не добавляется, то узел все равно будет считаться не динамическим.
Пример
Исходный код
Скомпилированный узел
Если же
@click.capture.stop
заменить на@click.stop
или@click
, то патч флаги не будут заданы вообще и блок все равно будет не динамическим.The text was updated successfully, but these errors were encountered: