zoukankan      html  css  js  c++  java
  • (4) vue路由

    1  <router-view></router-view> 路由显示的位置

        <router-link></router-link>  相当于a连接    或者 this.$router.push({path:})

    2    mode

    router 文件夹中的index.js 文件

    export default new Router({

    mode:"history",

    routes: []

    })

    • history    url    http://localhost:8080/goods/img
    • hash    URL    http://localhost:8080/#/goods/img

    3 动态路由

                 index.js          /user/:name          url /user/zlt       {{ $route.params.name}}    页面显示zlt

    4路由嵌套   

    index.js

             export default new Router({

    routes: [
    {
    path: '/goods',
    name: 'gl',
    component: gl,
    children:[
    {path:'title',
    name:'title',
    component:title
    },
    {path:'img',
    name:'img',
    component:img
    }
    ]
    }
    ]
    })

    gl.vue 父组件

    <router-link to="/goods/title">标题</router-link>
    <router-link to="/goods/img">照片</router-link>
    <div>
    <router-view></router-view>
    </div>

  • 相关阅读:
    8086汇编 学习1
    微信小程序 websocket+node.js(ws)
    kali安装google 浏览器
    bugkuctf Easy_Re
    课设记录-Day06
    GitLab使用教程
    课设记录-Day05
    课设记录-Day04
    课设记录-Day03
    课设记录-Day02
  • 原文地址:https://www.cnblogs.com/nns4/p/7453090.html
Copyright © 2011-2022 走看看