将URL作为参数传递,需将URL进行转义,可以使用JS中提供转义字符串和解析字符串的方法
解析字符串(decodeURIComponent)
let url = 'http%3A%2F%2Fm.test.com%2Flogin'
url = decodeURIComponent(url)
console.log(url)
// http://m.test.com/login
转义字符串(encodeURIComponent)
let url = 'http://m.test.com/login'
url = encodeURIComponent(url)
console.log(url)
// 'http%3A%2F%2Fm.test.com%2Flogin'