Browse Source

fix:修复图片动态引入

pull/46/head
肖晋飞 3 weeks ago
parent
commit
38f744b699
  1. 1
      src/views/dashboard/demo/components/demo.json
  2. 4
      src/views/dashboard/demo/components/staticImg.vue

1
src/views/dashboard/demo/components/demo.json

@ -2,7 +2,6 @@
"title": "示例设备展示", "title": "示例设备展示",
"LeftUp": { "LeftUp": {
"Header": "设备静态图", "Header": "设备静态图",
"pathq": "/src/assets/images/header.jpg",
"path": "/src/assets/svg/illustration.svg", "path": "/src/assets/svg/illustration.svg",
"Content": "" "Content": ""
}, },

4
src/views/dashboard/demo/components/staticImg.vue

@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { Card, CardGrid } from 'ant-design-vue' import { Card, CardGrid } from 'ant-design-vue'
import { ref } from 'vue'
import { navItems } from './data' import { navItems } from './data'
import { Icon } from '@/components/Icon' import { Icon } from '@/components/Icon'
@ -9,10 +10,11 @@ const props = defineProps({
default: () => {}, default: () => {},
}, },
}) })
const imgUrl = ref(new URL(props.data.path, import.meta.url).href)
</script> </script>
<template> <template>
<Card class="enter-y !my-1" :title="props.data.Header"> <Card class="enter-y !my-1" :title="props.data.Header">
<img class="mx-auto h-50 w-full" :src="props.data.path"> <img class="mx-auto h-50 w-full" :src="imgUrl">
</Card> </Card>
</template> </template>

Loading…
Cancel
Save