当前位置:网站首页>“router-link”各种属性解释
“router-link”各种属性解释
2022-07-27 14:23:00 【讲礼貌】
1.”:to” 属 性
相当于a标签中的”herf”属性,后面跟跳转链接所用
<router-link :to="/home">Home</router-link>
<!-- 渲染结果 -->
<a href="/home">Home</a>
2.”replace” 属 性
replace在routre-link标签中添加后,页面切换时不会留下历史记录
<router-link :to="/home" replace></router-link>
3.”tag” 属 性
具有tag属性的router-link会被渲染成相应的标签
<router-link :to="/home" tag="li">Home</router-link>
<!-- 渲染结果 -->
<li>Home</li>
此时页面的li同样会起到a链接跳转的结果,vue会自动为其绑定点击事件,并跳转页面
4.”active-class” 属 性
这个属性是设置激活链接时class属性,也就是当前页面所有与当前地址所匹配的的链接都会被添加class属性
<router-link :to="/home" active-class="u-link--Active">Home</router-link>
active-class属性的默认值是router-link-active,所以如果没有设置,就会被渲染为这个class
可以在router.Js里面设置
const router = new VueRouter({
mode: 'hash',
linkActiveClass: 'u-link--Active', // 这是链接激活时的class
})
5.”exact” 属 性
开启router-link的严格模式
<router-link :to="/" exact>home</router-link>
上面这个标签如果不加exact属性,则会在vue2.leenty.com/article页面下也会被匹配到,
这却不是我们的本意,在加了这个属性后就会正确的匹配到vue2.leenty.com下
边栏推荐
- reflex
- Leetcode-1737-满足三条件之一需改变的最少字符数
- 仅做两项修改,苹果就让StyleGANv2获得了3D生成能力
- Basic usage of kotlin
- Selenium reports an error: session not created: this version of chromedriver only supports chrome version 81
- 魔塔项目中的问题解决
- Spark lazy list files 的实现
- Network equipment hard core technology insider router 19 dpdk (IV)
- Watermelon book machine learning reading notes Chapter 1 Introduction
- 资本频频加码,急于上市的和府捞面有多“疯狂”?
猜你喜欢

Design scheme of digital oscilloscope based on stm32

With just two modifications, apple gave styleganv2 3D generation capabilities

Record record record

USB2.0接口的EMC设计方案

Unity performance optimization ----- LOD (level of detail) of rendering optimization (GPU)

How to take satisfactory photos / videos from hololens

Four kinds of relay schemes driven by single chip microcomputer

工具 - markdown编辑器常用方法

西瓜书《机器学习》阅读笔记之第一章绪论

Unity性能优化------渲染优化(GPU)之Occlusion culling(遮挡剔除)
随机推荐
Internship: compilation of other configuration classes
Adaptation verification new occupation is coming! Huayun data participated in the preparation of the national vocational skill standard for information system adaptation verifiers
Unity's simplest object pool implementation
Unity性能优化------渲染优化(GPU)之LOD(Level of detail)
两阶段提交与三阶段提交
Dan bin Investment Summit: on the importance of asset management!
DIY制作示波器的超详细教程:(一)我不是为了做一个示波器
USB2.0接口的EMC设计方案
After configuring corswebfilter in grain mall, an error is reported: resource sharing error:multiplealloworiginvalues
"Sword finger offer" linked list inversion
MOS管防止电源反接的原理
Reading notes of lifelong growth (I)
Unity mouse controls the first person camera perspective
Network equipment hard core technology insider router Chapter 18 dpdk and its prequel (III)
Singles cup, web:web check in
STM32 can -- can ID filter analysis
Multi table query_ Sub query overview and multi table query_ Sub query situation 1 & situation 2 & situation 3
Dialog manager Chapter 3: create controls
RS485接口的EMC设计方案
Four kinds of relay schemes driven by single chip microcomputer