补充组件
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="course-item-box" @click="clickItem">
|
||||
<view class="img-box-view">
|
||||
<ImagePreview class="img-box"></ImagePreview>
|
||||
<ImagePreview class="img-box" :imgId="itemInfo.imgId"></ImagePreview>
|
||||
<view class="item-grade">{{itemInfo.evalGrade}}</view>
|
||||
</view>
|
||||
<view class="cont-box">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<!-- <image :src="imgUrlShow"></image> -->
|
||||
<image class="img" src="@/static/images/test/1.png"></image>
|
||||
<image :src="imgUrlShow"></image>
|
||||
<!-- <image class="img" src="@/static/images/test/1.png"></image> -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -8,7 +8,7 @@
|
||||
export default {
|
||||
name:"image-preview",
|
||||
props:{
|
||||
modelValue:{
|
||||
imgId:{
|
||||
default:'',
|
||||
type:String
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
modelValue: {
|
||||
imgId: {
|
||||
handler(newval, oldval) {
|
||||
if (newval) {
|
||||
this.getPreviewUrlBlob(newval);
|
||||
@@ -40,20 +40,20 @@
|
||||
},
|
||||
methods: {
|
||||
getPreviewUrlBlob(id) {
|
||||
this.imgUrlShow = '@/static/images/index/message_b.png'
|
||||
// previewFile(id).then((res) => {
|
||||
// this.imgUrlShow = URL.createObjectURL(res);
|
||||
// // const reader = new FileReader();
|
||||
// // reader.readAsDataURL(res)
|
||||
// // reader.onloadend = () => {
|
||||
// // this.imgUrlShow = reader.result;
|
||||
// // }
|
||||
// });
|
||||
// this.imgUrlShow = '@/static/images/index/message_b.png'
|
||||
previewFile(id).then((res) => {
|
||||
this.imgUrlShow = URL.createObjectURL(res);
|
||||
// const reader = new FileReader();
|
||||
// reader.readAsDataURL(res)
|
||||
// reader.onloadend = () => {
|
||||
// this.imgUrlShow = reader.result;
|
||||
// }
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
if (this.modelValue) {
|
||||
this.getPreviewUrlBlob(this.modelValue);
|
||||
if (this.imgId) {
|
||||
this.getPreviewUrlBlob(this.imgId);
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
||||
Reference in New Issue
Block a user