在A页面设置了一个按钮,点击后通过target="_blank"跳转到B页面,然后想要在B页面点击提交或者返回的时候回到原来的页面,代码如下:
//A页面
<a class="iconfont font_do" title="填写问卷" :href="'./question.html?id='+item.id" target="_blank" ></a>
//B页面
// 教师查看回答后返回
goBack:function () {
setTimeout(function() {window.close();},1000);
},
如果是完成提交后再返回。则需要将close方法放在成功的提示后面即可
success: function(res){
if(res.result){
box.popAlert('提交成功');
// 点击提交问卷,提示成功后一秒再关闭 _blank
setTimeout(function() {window.close();},1000);
}
else{
box.popAlert2(res.msg);
}
},