海詩網(wǎng) 知識百科 vue(vue下載)

vue(vue下載)

vue, 一般來說vue也就是Vue路由,就是可以根據(jù)不同的地址創(chuàng)建不同的頁面。而route就是一個路由,route就是url到函數(shù)的映射,可以把url路徑映射到一個函數(shù)。當然,

Route也可以等價于當前跳轉的對象,從中可以獲得名稱、路徑、參數(shù)、查詢等。

vue下載

展開:

在vue中使用vue-route的方法:

1.首先,你需要下載vue路由器。

That is, npm installs vue- router-save.

2、編碼

1.首先需要在項目中創(chuàng)建一個新的文件夾router/index.js。具體說明如下:

/*

*路由對象模塊

* */

import Vue from vue

import VueRouter from vue-router

/*介紹頁面*/

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: /,

重定向:/msite //系統(tǒng)默認頁面

}

]

})

vue下載

2.然后就可以在main.js中全局使用路由器了具體說明如下:

//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 the router from. /router //Introduce routing

/* eslint-disable no-new */

new Vue({

el: #app,

components: { App },

template: App/,

路由器//介紹路由

})

以上是邊肖的分享,希望對大家有所幫助。

vue,以上就是本文為您收集整理的vue最新內容,希望能幫到您!更多相關內容歡迎關注。

本文來自網(wǎng)絡,不代表海詩網(wǎng)立場,轉載請注明出處:http://x91880.com/n/169160.html
      

anaconda3安裝詳細教程(anaconda3官網(wǎng)下載安裝)

發(fā)表回復
聯(lián)系我們
聯(lián)系我們

在線咨詢: QQ交談

郵箱: 3587015498@qq.com

工作時間:周一至周五,9:00-17:30,節(jié)假日休息

關注微信
微信掃一掃關注我們
微信掃一掃關注我們
關注微博
返回頂部