vue route
vue route是怎样的呢?下面就让我们一起来了解一下吧:
vue一般来说也就是Vue路由,即可以根据不同地址,创造不同页面。而route即一个路由,路由是url到函数的映射,它能够将url路径与一个函数进行映射,当然,route也能够相当于当前正在跳转的对象,可从里面获取name、path、params、query等。
拓展:
在vue中使用vue-route的方式:
1、首先需要下载vue-router
即npm install vue-router --save
2、进行编码
1.需要先在项目中新建文件夹router/index.js。具体指令为:
/*
* 路由对象模块
* */
import Vue from 'vue'
import VueRouter from 'vue-router'
/*引入pages*/
const MSite = ()=>import('../pages/MSite/MSite');
const Profile = ()=>import('../pages/Profile/profile');
const Patient = ()=>import('../pages/Patient/Patient');
//申明使用插件
Vue.use(VueRouter)
export default new VueRouter({
routes:[
{
path:'/msite',
component: MSite,
meta: {
showFooter: true
}
},
{
path:'/profile',
component:Profile,
meta: {
showFooter: true
}
},
{
path:'/patient',
component:Patient,
meta: {
showFooter: false
}
},
{
path: '/',
redirect: '/msite' //系统默认页
}
]
})
2.接着就可以在main.js中全局使用router了,具体指令为:
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router' //引入路由
/* eslint-disable no-new */
new Vue({
el: '#app',
components: { App },
template: '<App/>',
router //引入路由
})
-
大众双离合变速箱异响怎么办?
大众双离合变速箱异响的原因如下:1、双离合变速器换挡过程中,最终需要通过换挡拨叉完成换挡选择,换挡拨叉工作时就会比较容易产生异响;2、还有就是离合器的总成也是在换挡过程中发出异...
问答查看全文>> -
702T1绞肉机怎么样-美的MC30M1-702T1绞肉机测评 美的MC30M1
今天我们来和大家一起聊一聊关于这款美的MC30M1-702T1绞肉机怎么样吧,美的这个品牌旗下的产品整体的性能和设计还是十分的优越的,而且这款美的MC30M1-702T1绞肉机...
品牌查看全文>> -
u0298故障码解释及消除方法,U0298故障码怎么解决?
U0298故障码,适用于所有汽车制造商意思是与直流转直流换流器控制模块A通讯丢失(Lost Communication With DC to DC Converter Cont...
问答查看全文>> -
福特蒙迪欧车载蓝牙怎么连接,蒙迪欧手机互联映射教程
福特蒙迪欧车载蓝牙连接映射教程图解1、首先确认车辆蓝牙已经打开,同时把手机上的蓝牙设置可见状态;2、手机蓝牙下方点击“搜索新设备”,点击车载蓝牙的名称即可开始连接;3、点击车载...
问答查看全文>>
推荐
- 1现代ix35后备箱怎么开,现代ix35后备箱怎么锁321
- 2柴油增压器坏了的症状是什么?341
- 3气囊灯亮了怎么消除?消除汽车气囊灯亮的方法434
- 4充满文学气息的晚安语录343
- 510款奥迪a4l有哪些通病?486
- 6柯米克有什么缺点?315
- 7未悬挂号牌扣分?147
- 8艾力绅正时链条多久更换一次?244