fix:修复图片加载的问题

This commit is contained in:
zhanghao 2025-12-17 14:29:32 +08:00
parent d1742ae98c
commit 85be4085b8

View File

@ -2,7 +2,7 @@
<div class="title__container"> <div class="title__container">
<div class="title"> <div class="title">
<div class="left"> <div class="left">
<img :src="icon" alt="" /> <img :src="imageUrl()" alt="" />
<div class="text__container"> <div class="text__container">
<div class="text__title" v-if="showTextTitle"> <div class="text__title" v-if="showTextTitle">
<span class="text">{{ nodeName }}</span> <span class="text">{{ nodeName }}</span>
@ -76,6 +76,7 @@
import { ref } from 'vue' import { ref } from 'vue'
import { EditPen, Select, CloseBold, Delete, ZoomOut, ZoomIn, VideoPlay } from '@element-plus/icons-vue' import { EditPen, Select, CloseBold, Delete, ZoomOut, ZoomIn, VideoPlay } from '@element-plus/icons-vue'
import { ElMessageBox } from 'element-plus' import { ElMessageBox } from 'element-plus'
import { computed } from 'vue'
const props = defineProps({ const props = defineProps({
icon: { icon: {
@ -170,6 +171,23 @@ const handleInputKeydown = (e) => {
e.returnValue = true; // e.returnValue = true; //
} }
} }
// const svgModules = import.meta.glob('../icon/*.svg', { eager: true });
// console.log('svgModules', svgModules)
// const imageUrl = computed(async () => {
// if (props.icon && props.icon.startsWith('/src/')) {
// const modules = await import(`${props.icon}`);
// console.log('modules', modules)
// return modules.default
// } else {
// return props.icon;
// }
// })
const imageUrl = () => {
console.log('props.icon', props.icon)
return new URL(props.icon, import.meta.url).href;
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.title__container { .title__container {