zoukankan      html  css  js  c++  java
  • vue中的this.$ 都有什么

    <router-link :to="{name:'home'}">
    <router-link :to="{path:'/home'}">

    <router-link :to="{name:'home', params: {id:1}}">

    // params传参数 (类似post)
    // 路由配置 path: "/home/:id" 或者 path: "/home:id"
    // 不配置path ,第一次可请求,刷新页面id会消失
    // 配置path,刷新页面id会保留

    // html 取参 $route.params.id
    // script 取参 this.$route.params.id

    <router-link :to="{name:'home', query: {id:1}}">

    // query传参数 (类似get,url后面会显示参数)
    // 路由可不配置

    // html 取参 $route.query.id
    // script 取参 this.$route.query.id

    1、this.$router.push()   路由跳转

    this.$router.back()

    this.$router.go()

    this.$router.push({name:'home',query: {id:'1'}})
    this.$router.push({path:'/home',query: {id:'1'}})

    // html 取参 $route.query.id
    // script 取参 this.$route.query.id

    this.$router.push({name:'home',params: {id:'1'}}) // 只能用 name

    // 路由配置 path: "/home/:id" 或者 path: "/home:id" ,
    // 不配置path ,第一次可请求,刷新页面id会消失
    // 配置path,刷新页面id会保留

    // html 取参 $route.params.id
    // script 取参 this.$route.params.id

    3.  this.$router.replace() (用法同上,push)

  • 相关阅读:
    精选PSD素材下载周刊【Goodfav PSD 20130720】
    25个吸引眼球的广告设计
    25个让人无法抗拒的HTML5网站设计实例
    10个非常有用的网页设计工具
    为网页设计师准备的30个使用的HTML5框架
    ElasticSearch
    Dism命令实操
    Bash Shell
    Lua语言学习
    开发命令
  • 原文地址:https://www.cnblogs.com/bigbang66/p/14517956.html
Copyright © 2011-2022 走看看