图片预览功能
This commit is contained in:
parent
47f77bcc6f
commit
5f7e4c45db
@ -352,6 +352,7 @@
|
|||||||
:on-success="handleOnUploadSuccess"
|
:on-success="handleOnUploadSuccess"
|
||||||
:on-exceed="handleOnUploadExceed"
|
:on-exceed="handleOnUploadExceed"
|
||||||
:on-remove="handleOnUploadRemove"
|
:on-remove="handleOnUploadRemove"
|
||||||
|
:on-preview="handleOnUploadPreview"
|
||||||
list-type="picture"
|
list-type="picture"
|
||||||
>
|
>
|
||||||
<em class="el-icon-upload" />
|
<em class="el-icon-upload" />
|
||||||
@ -408,6 +409,17 @@
|
|||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 预览弹窗 -->
|
||||||
|
<el-dialog
|
||||||
|
:visible.sync="previewVisible"
|
||||||
|
:title="previewTitle"
|
||||||
|
class="preview_dialog_wrapper"
|
||||||
|
>
|
||||||
|
<div class="preview_content">
|
||||||
|
<img :src="previewUrl" alt="" class="preview_img" />
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -437,6 +449,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
|
|
||||||
//
|
//
|
||||||
actionUrl: process.env.VUE_APP_BASE_API + "/custom/fileUpload/ingredient",
|
actionUrl: process.env.VUE_APP_BASE_API + "/custom/fileUpload/ingredient",
|
||||||
// 选中数组
|
// 选中数组
|
||||||
@ -480,6 +493,10 @@ export default {
|
|||||||
form: {},
|
form: {},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {},
|
rules: {},
|
||||||
|
//
|
||||||
|
previewVisible: false,
|
||||||
|
previewUrl: "",
|
||||||
|
previewTitle: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -704,6 +721,23 @@ export default {
|
|||||||
type: "warning",
|
type: "warning",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
handleOnUploadPreview(file) {
|
||||||
|
console.log(file);
|
||||||
|
this.previewTitle = file.name;
|
||||||
|
this.previewVisible = true;
|
||||||
|
this.previewUrl = file.url;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.preview_dialog_wrapper {
|
||||||
|
.preview_content {
|
||||||
|
text-align: center;
|
||||||
|
.preview_img {
|
||||||
|
max-height: 600px;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user