Skip to content
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

vue 的局限 #180

Open
lovelmh13 opened this issue Aug 3, 2023 · 0 comments
Open

vue 的局限 #180

lovelmh13 opened this issue Aug 3, 2023 · 0 comments

Comments

@lovelmh13
Copy link
Owner

script 和 template 带来的问题

  1. 在一个组件文件里,视图和代码是分开的,如果在组件 export 之前写的变量,在组件销毁以后也会保存在内存里,而不是一起被销毁。如果写在 data 里,那没事儿。 因为销毁的是组件,而我们写的组件的文件,不全是组件,只有 export 导出的那些代码会被用到组件里。
    有点儿像是闭包,如果处理不好会有内存泄漏的问题
    vue 示例:
image 在 mpx 里这么写: image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant