动态添加a标签打开新网页

var url = 'http://127.0.0.1:9056//statistical/print-review/'
if (value.companyName === null || value.companyName === undefined || value.companyName === '') {
       url = url + value.regId + '/null/'+ this.peopleListTotal
 }else {
       url = url + value.regId + '/' +value.companyName +'/'+ this.peopleListTotal
}
 const a = document.createElement('a') // 创建a标签
a.setAttribute('target', 'top') //href链接
a.setAttribute('href', url) //href链接
a.click() // 自执行点击事件
posted @ 2022-05-30 13:41  埃菲尔上的加菲猫  阅读(349)  评论(0编辑  收藏  举报