mirror of
https://gitee.com/dromara/go-view.git
synced 2025-02-24 08:12:49 +08:00
fix: 处理搜索结果无法展示图片的问题
This commit is contained in:
parent
ed5752b692
commit
36f9fd2d49
@ -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
|
||||
// 兼容旧数据
|
||||
|
@ -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>
|
@ -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: {
|
||||
|
Loading…
Reference in New Issue
Block a user