feat: 修复背景图 顶栏图路径错误

This commit is contained in:
huanghao1412 2024-01-24 09:19:29 +08:00
parent abb99c6f77
commit ee54a366f0
3 changed files with 20 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -3,7 +3,7 @@
<n-image <n-image
:object-fit="fit" :object-fit="fit"
preview-disabled preview-disabled
:src="`/src/assets/images/chart/customponents/${dataset}`" :src="imageInfo"
:fallback-src="requireErrorImg()" :fallback-src="requireErrorImg()"
:width="w" :width="w"
lazy lazy
@ -13,10 +13,11 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { PropType, toRefs } from 'vue' import { PropType, toRefs, ref } from 'vue'
import { requireErrorImg } from '@/utils' import { requireErrorImg } from '@/utils'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
// import background from '@/assets/customComponents/theme1/backgrond.jpg' // import background from '@/assets/customComponents/theme1/backgrond.jpg'
import { fetchImages } from '@/packages'
const props = defineProps({ const props = defineProps({
chartConfig: { chartConfig: {
@ -28,6 +29,13 @@ const props = defineProps({
const { w, h } = toRefs(props.chartConfig.attr) const { w, h } = toRefs(props.chartConfig.attr)
const { dataset, fit, borderRadius } = toRefs(props.chartConfig.option) const { dataset, fit, borderRadius } = toRefs(props.chartConfig.option)
let imageInfo = ref('')
//
const fetchImageUrl = async () => {
imageInfo.value = await fetchImages(props.chartConfig.chartConfig)
}
fetchImageUrl()
const getStyle = (radius: number) => { const getStyle = (radius: number) => {
return { return {
borderRadius: `${radius}px`, borderRadius: `${radius}px`,

View File

@ -3,7 +3,7 @@
<n-image <n-image
:object-fit="fit" :object-fit="fit"
preview-disabled preview-disabled
:src="`/src/assets/images/chart/decorates/${dataset}`" :src="imageInfo"
:fallback-src="requireErrorImg()" :fallback-src="requireErrorImg()"
:width="w" :width="w"
lazy lazy
@ -13,9 +13,10 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { PropType, toRefs } from 'vue' import { PropType, ref, toRefs } from 'vue'
import { requireErrorImg } from '@/utils' import { requireErrorImg } from '@/utils'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { fetchImages } from "@/packages/index";
const props = defineProps({ const props = defineProps({
chartConfig: { chartConfig: {
@ -27,6 +28,13 @@ const props = defineProps({
const { w, h } = toRefs(props.chartConfig.attr) const { w, h } = toRefs(props.chartConfig.attr)
const { dataset, fit, borderRadius } = toRefs(props.chartConfig.option) const { dataset, fit, borderRadius } = toRefs(props.chartConfig.option)
let imageInfo = ref('')
//
const fetchImageUrl = async () => {
imageInfo.value = await fetchImages(props.chartConfig.chartConfig)
}
fetchImageUrl()
const getStyle = (radius: number) => { const getStyle = (radius: number) => {
return { return {
borderRadius: `${radius}px`, borderRadius: `${radius}px`,