Browse Source

perf(views): 优化“基础信息”步骤图片地址异常问题

wangshun 1 month ago
parent
commit
45c4d36817
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/views/create-device/BasicInformation.vue

+ 6 - 2
src/views/create-device/BasicInformation.vue

@@ -1,5 +1,5 @@
 <script setup lang="ts">
-import { onMounted, ref } from 'vue';
+import { computed, onMounted, ref } from 'vue';
 
 import SvgIcon from '@/components/SvgIcon.vue';
 import { useRequest } from '@/hooks/request';
@@ -19,6 +19,10 @@ const selectTypeRquipment = (value: SelectValue, option: DefaultOptionType) => {
   props.form.imgUrl = option.imgUrl;
 };
 
+const imgUrl = computed(() => {
+  return import.meta.env.VITE_IMG_API + props.form.imgUrl;
+});
+
 onMounted(() => {
   handleRequest(async () => {
     deviceGroup.value = await getPageList();
@@ -66,7 +70,7 @@ onMounted(() => {
         </AFormItem>
       </ACol>
       <ACol :span="18" v-if="form.deviceType">
-        <img class="information-img" referrerpolicy="no-referrer" :src="'http://192.168.1.136:9000/' + form.imgUrl" />
+        <img class="information-img" referrerpolicy="no-referrer" :src="imgUrl" />
       </ACol>
     </ARow>
   </div>