美文网首页
路由获取参数

路由获取参数

作者: 若水亦城空 | 来源:发表于2020-07-02 15:43 被阅读0次

    引用地址

    案例
    http://192.168.0.107:9528/?token=c3fa66266eab4b89a693f3e24a0547e3&system=aaa#/dashboard
    import { urlGet } from '@/utils/index'
    
    

    引用方法

      const $_GET = urlGet()
      $_GET['token']
    $_GET['system']
    ````````````````````````
    
    ## utils/index'
    ```````````````
    /**
     * @param {string} url
     * @returns {Object}
     */
    export function urlGet() {
      var parts = window.location.search.substr(1).split('&')
      var $_GET = {}
      for (var i = 0; i < parts.length; i++) {
        var temp = parts[i].split('=')
        $_GET[decodeURIComponent(temp[0])] = decodeURIComponent(temp[1])
      }
      return $_GET
    }
    ````````````````````

    相关文章

      网友评论

          本文标题:路由获取参数

          本文链接:https://www.haomeiwen.com/subject/aajrqktx.html