vue拼接html中a标签onclick
<a onclick="js_method(\''+item.cutovercucCaseNoRoam+'\')" >点击</a>
mounted(){
window.js_method=(val)=>{
this.js_method(val)
}
},
post跳转,不受get长度限制
<iframe src="about:blank" id="leftFrame" name="leftFrame" frameborder="0"></iframe>
js_method(val) {
if(val) {
let url = val;
let params = url.split('?')[1];
let paramsObj = {};
if (params) {
let paramsArr = params.split('&');
for (let i = 0; i < paramsArr.length; i++) {
let param = paramsArr[i].split('=');
paramsObj[param[0]] = param[1];
}
}
let encryptdata = paramsObj['encryptdata'];
var urls = url.split('?')[0];
var html1 = '<form id="queryForm" name="queryForm" method="post" target="_blank" action="' + urls + '">' +
'<input type="hidden" id="encryptdata" name="encryptdata" value="' + encryptdata + '"/>' +
'</form>';
console.log(html1);
document.getElementById('leftFrame').contentWindow.document.write(html1);
document.getElementById('leftFrame').contentWindow.document.getElementById('queryForm').submit();
document.getElementById('leftFrame').contentWindow.location.reload();
}
},