| 当前链接为http://www.example.com?code='123445'&python='django'
将上述code取出来并赋值给新的ret变量
在vue2中:
1、beforeMount(){
// 用方法取出当前的链接,赋值给常量href
const href = window.location.href
// 截取参数的那一个片段,即从?开始
const str = href.substr(href.indexOf("?")+1,href.length)
// 将&分隔符分开
const params = str.split('&')
// 取出我们想要的第一个code参数
const code = params[0].split('=')[1]
}