vue-router: <router-link>配
作者:
饥人谷_米弥轮 | 来源:发表于
2017-08-29 01:45 被阅读161次<router-link>
- router-link组件支持用于在具有路由功能的应用中进行导航
- 配置项:
- to 指定元素跳转到路由设定的地址链接
- tag 将router-link标签转成所设置标签,默认为a标签
- event 更改事件触发方式
- replace 页面切换后不会留下历史记录
- exact 开启vue严格模式,不开启此模式时,由于在
http://localhost:8080/document
也包含了/
根目录,所以当有/
的路由配置时,vue就会将根目录下的标签渲染上CSS,一直存在
- active-class 设置当前标签的css(class),此配置为局部设置,只作用于当前配置的router-link标签,全局设置需要在路由中添加 linkActiveClass属性
//app.vue router-link配置项
<router-link :to='index' exact replace tag="li" event="mouseover"></router-link>
//router/index.js 路由配置文件
export default new Router({
mode: 'history',
linkActiveClass: 'is-active',
routes: [ {
path: '/home',
component: home
}]
})
本文标题:vue-router: <router-link>配
本文链接:https://www.haomeiwen.com/subject/opyndxtx.html
网友评论