vue高级路由
1.html
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
<div id="app">
<h1>Hello App!</h1>
<p>
<!-- use router-link component for navigation. -->
<!-- specify the link by passing the `to` prop. -->
<!-- <router-link> will be rendered as an `<a>` tag by default -->
<router-link to="/foo11">Go to Foo</router-link>
<router-link to="/bar11">Go to Bar</router-link>
</p>
<!-- route outlet -->
<!-- component matched by the route will render here -->
<router-view></router-view>
</div>
2.js
// 0. If using a module system, call Vue.use(VueRouter)
// 1. Define route components.
// These can be imported from other files
const Foo = { template: '<div>foo</div>' }
const Bar = { template: '<div>bar</div>' }
// 2. 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.
const routes = [
{ path: '/foo111', component: Foo },
{ path: '/bar111', component: Bar }
]
// 3. Create the router instance and pass the `routes` option
// You can pass in additional options here, but let's
// keep it simple for now.
const router = new VueRouter({
routes
})
// 4. Create and mount the root instance.
// Make sure to inject the router with the router option to make the
// whole app router-aware.
const app = new Vue({
router
}).$mount('#app')
// Now the app has started!
3.css
.router-link-active {
color: red;
}
vue高级路由的更多相关文章
- vue嵌套路由总结
嵌套路由就是在一个被路由过来的页面下可以继续使用路由,嵌套也就是路由中的路由的意思. 比如在vue中,我们如果不使用嵌套路由,那么只有一个<router-view>,但是如果使用,那么在一 ...
- vue嵌套路由 && 404重定向
第一部分: vue嵌套路由 嵌套路由是什么? 嵌套路由就是在一个被路由过来的页面下可以继续使用路由,嵌套也就是路由中的路由的意思. 比如在vue中,我们如果不使用嵌套路由,那么只有一个<rou ...
- vue嵌套路由与404重定向实现方法分析
第一部分: vue嵌套路由 嵌套路由是什么? 嵌套路由就是在一个被路由过来的页面下可以继续使用路由,嵌套也就是路由中的路由的意思. 比如在vue中,我们如果不使用嵌套路由,那么只有一个<rout ...
- vue(5)—— vue的路由插件—vue-router 常用属性方法
前端路由 看到这里可能有朋友有疑惑了,前端也有路由吗?这些难道不应该是在后端部分操作的吗?确实是这样,但是现在前后端分离后,加上现在的前端框架的实用性,为的就是均衡前后端的工作量,所以在前端也有了路由 ...
- vue父路由默认选中第一个子路由,切换子路由让父路由高亮不会消失
vue父路由默认选中第一个子路由,切换子路由让父路由高亮不会消失 正常默认会有 .router-active-class 识别高亮 达到以上注意: 1. exact 不要加 注意是不要加,exact ...
- vue的路由映射问题
遇到的问题 今天在项目中遇到了一个问题,明明在Router文件夹下的路由js映射文件中,配置好了,如下: // 生日贺卡 { path: 'birthdayRemind', component: lo ...
- 前端MVC Vue2学习总结(八)——Vue Router路由、Vuex状态管理、Element-UI
一.Vue Router路由 二.Vuex状态管理 三.Element-UI Element-UI是饿了么前端团队推出的一款基于Vue.js 2.0 的桌面端UI框架,手机端有对应框架是 Mint U ...
- ip route rule 路由策略 高级路由 捆绑 网桥
http://lwfs.net/2005/11/28/10/ #!/bin/bash IP0= IP1= GW0= GW1= NET0= NET1= DEV0=eth0 DEV1=eth1 # com ...
- linux 高级路由
1. 什么是高级路由? 是把信息从源穿过网络到达目的地的行为. 有两个动作:确定最佳路径,传输信息 确定最佳路径:手工指定,自动学习. 传输信息:隧道传输,流量整形 高级路由(策略路由)是根据一定的需 ...
随机推荐
- Dubbo超时重试机制带来的数据重复问题
Dubbo的超时重试机制为服务容错.服务稳定提供了比较好的框架支持,但是在一些比较特殊的网络环境下(网络传输慢,并发多)可能 由于服务响应慢,Dubbo自身的超时重试机制(服务端的处理时间超过了设定的 ...
- No goals have been specified for this build 解决方案
运行maven报错:[ERROR] No goals have been specified for this build. You must specify a valid lifecycle ph ...
- python使用pickle,json等序列化dict
import pickle, json, csv, os, shutil class PersistentDict(dict): ''' Persistent dictionary with an A ...
- SAP MM模块 经常使用函数
1. MM_CURRENT_PRICE_DOCUMENT 2. ME_READ_HISTORY 获取採购行项目的历史记录 CALL FUNCTION 'ME_READ_HISTORY' ...
- java学习路线-Java技术人员之路从0基础到高级
满满的 全是干货 java基础: 尚学堂 马士兵 个人推荐 历经5年锤练--史上最适合刚開始学习的人入门的Java基础视频 很具体 适合 时间多的看 传智播客java基础班 马士兵线程 ...
- NSTimer 增加引用计数, 导致内存泄露,
self.adTimer = [NSTimerscheduledTimerWithTimeInterval:5.0target:selfselector:@selector(handleADIma ...
- CSS3怎样实现超出指定文本以省略号显示效果
作者:zhanhailiang 日期:2014-10-24 不做前端非常久了,今天从重构师那里了解到CSS3已经能够实现非常多以往必须通过JS才干实现的效果,如渐变,阴影,自己主动截断文本展示省略号等 ...
- Android startActivities()的使用
startActivities()和startActivity类似,也是界面跳转: Intent[] intents = new Intent[2]; intents[0] = new Intent( ...
- ReferenceError: Promise is not define
尽管加入了babel-polyfill ,依然出现 [ReferenceError: Promise is not define]的问题.目前只在三星.金立手机出现这种问题.没办法,只能强行修复了. ...
- css - 紧贴底部的页脚
有的时候,由于页面长度不够,页面底部的页脚会很尴尬的跑上来,如图: 有的同学可能会想用position:fixed;bottom:0;来永远居底.但有些场景确实不适合. 这是我从YII2中找到的简单解 ...