-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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导致模板中使用的响应式数据发生更改时,函数都会被重新执行 #8613
Comments
This writing is incorrect. The render function depends on count, and every time the render function is executed, it will run data.slot. Within data.slot, count is changed, causing the render function to be executed again, resulting in an infinite loop. |
This writing cause infinite loop |
Because the scene is rendered through the v-for loop in the template, each sub-element needs to be dynamically rendered into the template as a parameter of the function. Is there any way to avoid the infinite loop? Similar to using markRaw api? grateful |
Do not modify variables dependent on the render function in the render function. |
The rendering function returns a simple string, but if other dependent objects of the current template change, it will also trigger the rendering function to re-execute |
As we know. template converted to dom need check the compiler code
when invoke so . u change count . the vue execute render again. The render execute again. the Although |
As @Alfred-Skyblue Said. |
Vue version
"vue": "^3.2.47"
Link to minimal reproduction
https://play.vuejs.org/#eNpNjkEOgjAQRa8yYQPEBFxjIfEe3RAoCQm0TRnYNE28hTdwpS5MTDgQ6jVsBcVZzfz5+e9rby9lNPTMSzyCrJVNjiyjHOyQsh6W9XdqXeaYR10jMAiNIfHq+e4k/sshXaFqidAx7KW961YKhaAVqwxUSrTgW7hPOeWF4B1CIXqOkII1BNtwtz4cd9H1DHQlEghCSDNYJDefhGjIm55tNqusbAPFwZ/Gw/N6f1yOr/NpGm8W7b6GchM6GInnxrYr5Z55AwrBY0c=
Steps to reproduce
无
What is expected?
希望可以不不会递归导致页面卡死
What is actually happening?
System Info
No response
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: