vue-router之路由屬性配置說明


export default new Router({
    mode: 'history'//路由模式,取值為history與hash
    base'/'//打包路徑,默認為/,可以修改
    routes: [
    {
        path: string//路徑
        component: Component; //頁面組件
        name: string// 命名路由-路由名稱
        components: ( ComponentName | ()=>import('頁面地址') ); // 命名視圖組件
        redirect: string | Location | Function; // 重定向
        props: boolean | string | Function; // 路由組件傳遞參數
        alias: string | Array<string>; // 路由別名
        children: Array<RouteConfig>; // 嵌套子路由
        beforeEnter?: (to: Route, from: Route, next: Function) => void// 路由單獨鈎子
        meta: any; // 自定義標簽屬性,比如:是否需要登錄
        icon: any; // 圖標
        // 2.6.0+
        caseSensitive: boolean; // 匹配規則是否大小寫敏感?(默認值:false)
        pathToRegexpOptions: Object; // 編譯正則的選項
    }
    ]})

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM