index.vue 642 Bytes
Newer Older
张成 committed
1
<template>
lixiaomin committed
2 3 4 5
  <el-image 
    style="width: 100px; height: 100px"
    :src="imgUrl" 
    :preview-src-list="imgList">
张成 committed
6 7 8 9 10 11
  </el-image>
</template>

<script>
export default {
  name: "ImagePreview",
lixiaomin committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
  props: ['imageValue'],
  data() {
		return {
			imgUrl: '',
      imgList: []
		}
	},
  watch: {
    imageValue: {
      handler(val) {
        if (val) {
          console.log("val",val);
          this.imgUrl=val;
          this.imgList.push(val);
     
        } else {
          this.imgList = [];
          return [];
张成 committed
30
        }
lixiaomin committed
31 32 33
      },
      deep: true,
      immediate: true,
张成 committed
34 35
    },
  },
lixiaomin committed
36

张成 committed
37 38 39 40
};
</script>

<style lang="scss" scoped>
lixiaomin committed
41

张成 committed
42
</style>