zoukankan      html  css  js  c++  java
  • vue

    官方API:https://router.vuejs.org/zh/guide/#javascript

    vue-cli for index.js

     1 export default new Router({
     2   mode: 'history', //路由模式,取值为history与hash
     3   base: '/', //打包路径,默认为/,可以修改
     4   routes: [
     5   {
     6       path: string, //路径
     7       ccomponent: Component; //页面组件
     8       name: string; // 命名路由-路由名称
     9       components: { [name: string]: Component }; // 命名视图组件
    10       redirect: string | Location | Function; // 重定向
    11       props: boolean | string | Function; // 路由组件传递参数
    12       alias: string | Array<string>; // 路由别名
    13       children: Array<RouteConfig>; // 嵌套子路由
    14       beforeEnter?: (to: Route, from: Route, next: Function) => void; // 路由单独钩子
    15       meta: any; // 自定义标签属性,比如:是否需要登录
    16       icon: any; // 图标
    17       // 2.6.0+
    18       caseSensitive: boolean; // 匹配规则是否大小写敏感?(默认值:false)
    19       pathToRegexpOptions: Object; // 编译正则的选项
    20   }
    21   ]
    22 })

    vue-cli for main.js

     1 // The Vue build version to load with the `import` command
     2 // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
     3 // 引入vue框架
     4 import Vue from 'vue'
     5 // 引入根组件
     6 import App from './App'
     7 // 引入路由配置
     8 import router from './router'
     9 
    10 // 关闭生产模式下给出的提示
    11 Vue.config.productionTip = false
    12 
    13 // 定义实例
    14 new Vue({
    15   el: '#app',
    16   router, // 注入框架中
    17   components: { App },
    18   template: '<App/>'
    19 })
  • 相关阅读:
    apt-get install jdk
    progit-zh(Git中文文档)
    indexedDB bootstrap angularjs 前端 MVC Demo
    状态模式
    使用TypeConverter类
    wpf 全局异常捕获处理
    WPF 中的形状和基本绘图概述
    WPF设计自定义控件
    WPF快速入门系列(9)——WPF任务管理工具实现
    WPF快速入门系列(8)——MVVM快速入门
  • 原文地址:https://www.cnblogs.com/cisum/p/9620214.html
Copyright © 2011-2022 走看看