1.使用CDN引用相关js
元字符集=\’UTF-8\’
meta http-equiv=\’X-UA 兼容\’ content=\’IE=edge\’
元名称=\’视口\’内容=\’宽度=设备宽度,初始比例=1.0\’
职称认证结果/职称
脚本src=\’https://unpkg.com/vue@3.4.27/dist/vue.global.prod.js\’/script
脚本src=\’https://unpkg.com/dayjs/dayjs.min.js\’/script
脚本src=\’https://unpkg.com/dayjs/plugin/customParseFormat.js\’/script
脚本src=\’https://unpkg.com/dayjs/plugin/weekday.js\’/script
脚本src=\’https://unpkg.com/dayjs/plugin/localeData.js\’/script
脚本src=\’https://unpkg.com/dayjs/plugin/weekOfyear.js\’/script
脚本src=\’https://unpkg.com/dayjs/plugin/weekyear.js\’/script
脚本src=\’https://unpkg.com/dayjs/plugin/advancedFormat.js\’/script
脚本src=\’https://unpkg.com/dayjs/plugin/quantOfyear.js\’/script
链接类型=\’text/css\’href=\’https://unpkg.com/ant-design-vue@4.2.3/dist/reset.css\’media=\’screen\’rel=\’stylesheet\’
脚本src=\’https://unpkg.com/ant-design-vue@4.2.3/dist/antd.min.js\’/script
脚本src=\’https://unpkg.com/axios/dist/axios.min.js\’/script
2.Result.html获取参数的值
已安装(()={
const queryString=new URLSearchParams(window.location.search);
msg.value=queryString.get(\’msg\’);
});
注意:请在传递消息之前对消息进行编码
例如:
@RequestMapping(路径=\’/myQrcodeGoResult\’, 方法=RequestMethod.GET)
公共ModelAndView MyQrcodeGoMResult(@RequestParam(name=\’msg\’, required=true) String msg, HttpServletRequest req,
HttpServletResponse 响应){
ModelAndView modelView=new ModelAndView();
modelView.setViewName(\’结果\’);
modelView.addObject(\’msg\’, msg);
System.out.println(JSON.toJSONString(modelView));
返回模型视图。
}
尝试{
String msg=\’绑定成功\’;
msg=URLEncoder.encode(msg,\’utf-8\’);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
导入java.net.URLEncoder。
3. 编码参数在收到页面后自动解码。即打印绑定成功。
4. URLSearchParams示例:
const paramsString=\’q=URLUtils.searchParamstopic=api\’;
const searchParams=new URLSearchParams(paramsString);
//遍历查询参数
for (在searchParams 中允许p) {
控制台.log(p);
}
console.log(searchParams.has(\’topic\’)); //true
console.log(searchParams.has(\’topic\’, \’fish\’)); //false
console.log(searchParams.get(\’topic\’)===\’api\’);
console.log(searchParams.getAll(\’topic\’)); //[\’api\’]
console.log(searchParams.get(\’foo\’)===null);
console.log(searchParams.append(\’topic\’, \’webdev\’));
console.log(searchParams.toString()); //\’q=URLUtils.searchParamstopic=apitopic=webdev\’
console.log(searchParams.set(\’主题\’, \’其他webdev\’));
console.log(searchParams.toString()); //\’q=URLUtils.searchParamstopic=More+webdev\’
console.log(searchParams.delete(\’主题\’));
console.log(searchParams.toString()); //\’q=URLUtils.searchParams\’
https://developer.mozilla.org/zh-CN/docs/Web/API/URLSearchParams
详情请参阅上面的链接地址。
上述#vue3 cdn的方法通过URLSearchParams获取参数信息。相关内容来源网络仅供参考。相关信息请参见官方公告。
原创文章,作者:CSDN,如若转载,请注明出处:https://www.sudun.com/ask/93148.html