a链接跳转新页面,从后端取地址,并且判断地址是否为空
作者:互联网
父组件是列表,子组件是弹窗。通过列表插槽的查看详情打开弹窗,点击a链接查看附件,跳到新页面查看pdf等网页文件
<a :href="attachUrl" :target="targetUrl" @click="checkAttach()">查看附件</a>
attachUrl: '#',
targetUrl: null,
在点击查看详情,子组件获取列表当前行数据的方法中
add(certifyData) {
this.visible = true
this.DataHistoryId = this.$parent.DataHistoryId//获取参数
this.execution_id = certifyData.execution_id//获取参数
this.attachUrl = '#'
this.targetUrl = null
let form = {
DataId: this.DataHistoryId,
ItemId: this.execution_id
}
getHistoryAttach(form).then(res => {
if (res.length !== 0) {
this.attachUrl = res[0].fVcPreviewUrl
this.targetUrl = '_blank'
}
})
},
checkAttach() {
if (this.attachUrl == '#') {
this.$message.warning('暂无附件')
}
}
标签:attachUrl,从后,查看,res,targetUrl,地址,跳转,execution,id 来源: https://blog.csdn.net/weixin_49668076/article/details/120751348