Browse Source

fix:图片路径问题

pull/48/head
肖晋飞 3 weeks ago
parent
commit
6767579d02
  1. 4
      src/views/dashboard/demo/components/demo.json
  2. 6
      src/views/dashboard/demo/components/staticImg.vue

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

@ -2,7 +2,7 @@
"title": "示例设备展示", "title": "示例设备展示",
"LeftUp": { "LeftUp": {
"Header": "设备静态图", "Header": "设备静态图",
"path": "../../../../assets/svg/illustration.svg", "path": "svg/illustration.svg",
"Content": "" "Content": ""
}, },
"LeftMidUp": { "LeftMidUp": {
@ -52,7 +52,7 @@
}, },
"LeftDown": { "LeftDown": {
"Header": "生产流程", "Header": "生产流程",
"path": "../../../../assets/svg/illustration.svg", "path": "svg/illustration.svg",
"Content": "/api/v1/assets/production_flow.svg" "Content": "/api/v1/assets/production_flow.svg"
}, },
"RightDown": { "RightDown": {

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

@ -10,7 +10,11 @@ const props = defineProps({
default: () => {}, default: () => {},
}, },
}) })
const imgUrl = ref(new URL(props.data.path, import.meta.url).href) const imgUrl = getAssetsFile(props.data.path)
// ../assets/imgs
function getAssetsFile(url: string) {
return new URL(`../../../../assets/${url}`, import.meta.url).href
}
</script> </script>
<template> <template>

Loading…
Cancel
Save