我的需求是跳转到第三方网站,看官方是写了如何跳转站内路由,不符合我的要求,在csdn发现了一篇文章,我贴一下代码
<template>
<Table border :columns="ReportColumns" :data="ReportData">
<template #name="{ row }">
<strong>{{ row.name }}</strong>
</template>
<template #action="{ row, index }">
<!-- <a href="http://wwww.baidu.com/" target="_blank">view</a>-->
<!-- <Button type="primary" size="small" style="margin-right: 5px" target="_blank" >View</Button>-->
<Button type="error" size="small" @click="remove(index)">Delete</Button>
</template>
</Table>
</template>
data(){
return{
ReportColumns:[
{
title: '生成时间',
key: 'createTime',
width: 220
},
{
title: '生成用户',
key: 'creator',
width: 200
},
{
title:'报告地址',
key:'reportUrl',
width: 800,
render: (h, params) => {
return h('span',
{
domProps: {
innerHTML: "<a href='" + params.row.reportUrl + "' target='_blank'>" + params.row.reportUrl + '</a>'
}
}
)
}
},
{
title: '操作',
slot: 'action',
}
],
后端接口报文格式
{
"ret": true,
"code": 0,
"msg": "查询成功",
"content": [
{
"id": 522,
"reportId": 2561,
"creator": "李朝阳",
"createTime": "2023-11-03 12:05:00",
"reportUrl":"http://192.168.0.1:1111/view/project/5f1e8e97b6e123455555"
},
{
"id": 523,
"reportId": 2562,
"creator": "白克玲",
"createTime": "2023-10-03 11:25:00",
"reportUrl":"https://blog.csdn.net/qq_42772400/article/details/128386185"
}
]
}
原贴地址
iview table实现通过render实现点击跳转到相应的网址_iview页面跳转-CSDN博客