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

<router-link> 和a标签的区别 #206

Open
TieMuZhen opened this issue May 14, 2022 · 0 comments
Open

<router-link> 和a标签的区别 #206

TieMuZhen opened this issue May 14, 2022 · 0 comments
Labels

Comments

@TieMuZhen
Copy link
Owner

a标签和router-link

a标签

<a href="">链接 </a>

点击a标签从当前页面跳转到另一个页面
通过a标签跳转,页面就会重新加载,相当于重新打开了一个网页

router-link

<router-link to=""></router-link>

通过router-link进行跳转不会跳转到新的页面,不会重新渲染,它会选择路由所指的组件进行渲染

区别

router-link避免了重复渲染,不像a标签一样需要重新渲染减少了DOM性能的损耗。

@TieMuZhen TieMuZhen added the Vue label May 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant