Эх сурвалжийг харах

Merge remote-tracking branch 'origin/dev' into master-fetch-dev

奔跑的面条 2 жил өмнө
parent
commit
09ac83a62b

+ 2 - 1
src/packages/index.ts

@@ -63,7 +63,8 @@ export const fetchConfigComponent = (dropData: ConfigType) => {
  * * 获取图片内容
  * @param {ConfigType} targetData 配置项
  */
-export const fetchImages = async (targetData: ConfigType) => {
+export const fetchImages = async (targetData?: ConfigType) => {
+  if (!targetData) return ''
   // 新数据动态处理
   const { image, package: targetDataPackage } = targetData
   // 兼容旧数据

+ 27 - 0
src/views/chart/ContentCharts/components/ChartsSearch/SearchImage.vue

@@ -0,0 +1,27 @@
+<template>
+  <img v-lazy="imageInfo" alt="展示图" />
+</template>
+
+<script setup lang="ts">
+import { ref, PropType } from 'vue'
+import { ConfigType } from '@/packages/index.d'
+import { fetchImages } from '@/packages'
+
+const props = defineProps({
+  item: {
+    type: Object as PropType<ConfigType>,
+  }
+})
+
+const imageInfo = ref('')
+
+// 获取图片
+const fetchImageUrl = async () => {
+  imageInfo.value = await fetchImages(props.item)
+}
+fetchImageUrl()
+</script>
+
+<style scoped>
+
+</style>

+ 2 - 1
src/views/chart/ContentCharts/components/ChartsSearch/index.vue

@@ -37,7 +37,7 @@
               :title="item.title"
               @click="selectChartHandle(item)"
             >
-              <img class="list-item-img" v-lazy="item.image" alt="展示图" />
+              <search-image class="list-item-img" :item="item"></search-image>
               <n-text class="list-item-fs" depth="2">{{ item.title }}</n-text>
             </div>
           </n-scrollbar>
@@ -77,6 +77,7 @@ import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayou
 import { isString, addEventListener, removeEventListener } from '@/utils'
 import { fetchConfigComponent, fetchChartComponent } from '@/packages/index'
 import { componentInstall, loadingStart, loadingFinish, loadingError } from '@/utils'
+import SearchImage from './SearchImage.vue'
 
 const props = defineProps({
   menuOptions: {