From cab6ab717f0f799c86cc7cb6aefbb73640208cd0 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期二, 14 十一月 2023 16:40:43 +0800
Subject: [PATCH] 查看页面编辑产品时图片无法修改

---
 src/views/productManage/product/IconCropper.vue |   28 +++++++++++++++++++++-------
 1 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/src/views/productManage/product/IconCropper.vue b/src/views/productManage/product/IconCropper.vue
index cc074b0..ee360dc 100644
--- a/src/views/productManage/product/IconCropper.vue
+++ b/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"

--
Gitblit v1.8.0