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

    在样式里面,,视口 是什么意思
    看到19了
     
     
     
    vue路由配置:
     
    1.安装
    npm install vue-router --save / cnpm install vue-router --save
     
    2、引入并 Vue.use(VueRouter) (main.js)
    import VueRouter from 'vue-router'
    Vue.use(VueRouter)
     
    3、配置路由
     
    1、创建组件 引入组件
     
    2、定义路由 (建议复制s)
     
    const routes = [
    { path: '/foo:aid', component: Foo }, --> 动态路由
    { path: '/bar', component: Bar },
    { path: '*', redirect: '/home' } /*默认跳转路由*/
    ]
     
    3、实例化VueRouter
     
    const router = new VueRouter({
    routes // (缩写)相当于 routes: routes
    })
     
    4、挂载
     
    new Vue({
    el: '#app',
    router,
    render: h => h(App)
    })
     
    5 、根组件的模板里面放上这句话 <router-view></router-view>
    这句话 会把 子页面的内容加载进来
     
     
    6、路由跳转
    <router-link to="/foo">Go to Foo</router-link>
    <router-link :to="'/bar?id='+key">Go to Bar</router-link> -->GET请求
     
     
    在url中传递参数的 分为俩种, get请求 和 动态路由
    在处理端 使用 this.$route.params 处理 动态路由
    使用 this.$route.query 处理get请求
     
     
     
     
     
  • 相关阅读:
    Unity编辑器
    Unity编辑器
    Unity编辑器
    MaxScript代码补全插件
    学习用MaxScipt批处理Max文件
    Unity编辑器
    Unity编辑器
    节属性 转 页属性
    在挂起的进程中创建一个远程线程
    Sql server 级联删除
  • 原文地址:https://www.cnblogs.com/onda/p/9204037.html
Copyright © 2011-2022 走看看