fix:修复图片加载的问题
This commit is contained in:
parent
d1742ae98c
commit
85be4085b8
@ -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 {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user