提交 c59e2f5f authored 作者: 王鹏飞's avatar 王鹏飞

bug fixes

上级 4aee4da8
{
"name": "@ezijing/vue-form",
"version": "2.0.6",
"version": "2.0.7",
"private": false,
"description": "基于Vue Element-UI的表单",
"scripts": {
......
......@@ -114,8 +114,15 @@ export default {
},
// 预览
handlePreview(file) {
this.dialogVisible = true
this.dialogImageUrl = file.url
const names = ['jpg', 'jpeg', 'png', 'gif']
const url = file.url.includes('?') ? file.url.split('?').shift() : file.url
const name = url.split('.').pop() || ''
if (names.includes(name.toLocaleLowerCase())) {
this.dialogVisible = true
this.dialogImageUrl = file.url
} else {
this.newWindowPreview(file.url)
}
},
// 删除
handleRemove(file, fileList) {
......@@ -127,6 +134,15 @@ export default {
this.$message.success(res.message)
})
.catch(error => this.$message.error(error.message))
},
// 新窗口预览
newWindowPreview(url) {
const a = document.createElement('a')
a.href = url
a.target = '_blank'
document.body.appendChild(a)
a.click()
a.remove()
}
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论