yangfeng
2023-11-14 cab6ab717f0f799c86cc7cb6aefbb73640208cd0
src/views/productManage/product/IconCropper.vue
@@ -127,16 +127,30 @@
      fileName: ""
    }
  },
  mounted() {
    console.log(this.imageUrl)
    if (!this.isView && this.imageUrl?.length > 0) {
      this.isPreview = true
      this.previewImg = this.imageUrl
    } else {
      this.isPreview = false
  computed: {
    myIsView() {
      return this.isView
    }
  },
  watch: {
    myIsView() {
      this.setImgMethods()
    }
  },
  mounted() {
    console.log(this.imageUrl)
    this.setImgMethods()
  },
  methods: {
    // 设置上传/更换图片显示方法
    setImgMethods() {
      if (!this.isView && this.imageUrl?.length > 0) {
        this.isPreview = true
        this.previewImg = this.imageUrl
      } else {
        this.isPreview = false
      }
    },
    // 上传按钮 限制图片大小和类型
    handleChangeUpload(file, fileList) {
      const isJPG = file.raw.type === "image/jpeg" || file.raw.type === "image/png"