使用vue路由器,我如何才能使菜单选择的样式
Using vue-router, how can I make menu selected styles?
我正在使用vue路由器创建一个单页应用程序。我有一个导航系统,点击菜单项可以将他们带到相应的页面。例如:
var pageView = require('./components/pageView.vue')
// Define some components
var Boards_page = Vue.extend( {
template: '<p>Boards</p>'
})
var Fantheories = Vue.extend( {
template: '<p>Character</p>'
})
// The router needs a root component to render.
// For demo purposes, we will just use an empty one
// because we are using the HTML as the app template.
// !! Note that the App is not a Vue instance.
var App = Vue.extend({})
// Create a router instance.
// You can pass in additional options here, but let's
// keep it simple for now.
var router = new VueRouter({
history: true
})
// Define some routes.
// Each route should map to a component. The "component" can
// either be an actual component constructor created via
// Vue.extend(), or just a component options object.
// We'll talk about nested routes later.
router.map({
'/': {
component: pageView
},
'/boards': {
component: Boards_page
},
'/fantheories': {
component: Fantheories_page
}
})
// Now we can start the app!
// The router will create an instance of App and mount to
// the element matching the selector #app.
router.start(App, '#container')
我该如何使我在菜单项上的任何URL都有不同的CSS样式,使其看起来像是被选中的?
路由器选项linkActiveClass
确定应用于活动链接的类。默认为v-link-active
。
http://vuejs.github.io/vue-router/en/options.html
相关文章:
- 基于其他下拉菜单选择隐藏/显示下拉菜单
- 使用vue路由器,我如何才能使菜单选择的样式
- Asp.net 引导下拉菜单 - 选择一个项目
- 检测引导下拉菜单选择的正确方法是什么
- 当上一个下拉菜单选择了某些内容时,javascript显示下拉菜单
- 转换UL->li inot为同位素过滤菜单选择的列表
- Jquery:在下拉菜单选择上调用函数
- Javascript菜单选择
- 如何根据下拉菜单选择隐藏/显示文本框
- 使用.on的多个下拉菜单选择文本仅适用于第一个下拉菜单
- 如何基于两个下拉菜单选择进行页面重定向
- WordPress 类别下拉菜单选择链接断开
- Jquery - 根据下拉菜单选择加载 XML 文件
- 使用下拉菜单选择不同的语言并翻译 RoR 3.2 Ruby 2.0
- 将下拉菜单选择保存在 Cookie 中
- JavaScript 披萨菜单选择列表
- 如何生成下拉菜单选择以根据数据库中可用的行/记录表单数据填充表单
- 尝试在鼠标悬停时为Wordpress中的下拉菜单选择添加突出显示
- 使后台生成的下拉菜单选择成为强制性的
- 求和2个跨度元素中的两个值(用户可以通过下拉菜单选择每个跨度元素的值)