zoukankan      html  css  js  c++  java
  • Vue-router

    -- 注册
    -- let url = [
    {
    path: "/",
    name: "home",
    component: {
    template: ``
    }
    }
    ]
    -- let router = new VueRouter({
    routes: url
    })
    -- const app = new Vue({
    el: "#app",
    router: router
    })
    -- <router-link to="/">首页</router-link>
    -- <router-view></router-view>
    -- 子路由
    -- children: [
    {}
    ]
    -- 在父路由对应的组件的template里写router-link router-view

    -- 命名路由
    -- name
    -- 注意to加冒号动态绑定
    -- 路由参数
    -- {
    path: "/course/:id",
    }
    -- this.$route.params.id
    -- this.$route.query.xxx
    -- $route 是一个对象 存放当前路由的所有信息
    -- $router VueRouter实例化对象
    -- 手动路由
    --this.$router.push("/")
    --this.$router.push({name: "xxx"})
    -- 重定向
    -- redirect:{name: "xxx"}
    -- 路由的钩子
    -- beforeEach
    -- to
    -- from
    -- next
    -- afterEach
    -- to
    -- from

  • 相关阅读:
    jsp 页面获取当前路径
    html5 页面音频
    微信关于网页授权access_token和普通access_token的区别
    Texlive source
    vscode 快捷键
    vscode setting
    vscode extension 插件管理
    what
    linux manual
    java tool type
  • 原文地址:https://www.cnblogs.com/wszxdzd/p/9966122.html
Copyright © 2011-2022 走看看