feat: 修复图片地址错误

This commit is contained in:
huanghao1412 2023-12-28 18:19:26 +08:00
parent d2d4e94f10
commit 0d9a4183d5
4 changed files with 31 additions and 33 deletions

View File

@ -2,11 +2,11 @@ import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d'
import { Theme1Config } from './index'
import cloneDeep from 'lodash/cloneDeep'
import background from '@/assets/customComponents/theme1/backgrond.jpg'
// import background from '@/assets/customComponents/theme1/backgrond.jpg'
export const option = {
// 图片路径
dataset: background,
dataset: '',
// 适应方式
fit: 'contain',
// 圆角

View File

@ -93,7 +93,7 @@
<n-image
:object-fit="fit"
preview-disabled
:src="option.dataset"
:src="background"
:fallback-src="requireErrorImg()"
:width="w"
:height="h"
@ -109,6 +109,7 @@ import { useChartDataFetch } from '@/hooks'
import { CreateComponentType } from '@/packages/index.d'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import moment from 'moment'
import background from '@/assets/customComponents/theme1/backgrond.jpg'
const props = defineProps({
chartConfig: {
@ -165,31 +166,33 @@ const getStyle = (radius: number) => {
}
}
//
watch(
() => props.chartConfig.option.dataset,
async (newData: any) => {
try {
const img = await import(newData);
option.dataset = img.default
} catch(e) {
console.log(e)
}
},
{
immediate: true
}
)
//
useChartDataFetch(props.chartConfig, useChartEditStore, async (newData: any) => {
try {
const img = await import(newData);
option.dataset = img.default
} catch(e) {
console.log(e)
}
})
// //
// watch(
// () => props.chartConfig.option.dataset,
// async (newData: any) => {
// try {
// // const img = await import(newData);
// // option.dataset = img.default
// option.dataset = newData
// } catch(e) {
// console.log(e)
// }
// },
// {
// immediate: true
// }
// )
//
// //
// useChartDataFetch(props.chartConfig, useChartEditStore, async (newData: any) => {
// try {
// // const img = await import(newData);
// // option.dataset = img.default
// option.dataset = newData
// } catch(e) {
// console.log(e)
// }
// })
</script>
<style lang="scss" scoped>

View File

@ -190,8 +190,6 @@ const rangeStyle = computed(() => {
}
})
console.log(chartEditStore.getComponentList)
onMounted(() => {
//
useAddKeyboard()

View File

@ -1,9 +1,7 @@
const bindEvent = (item:any) => {
console.log(item)
let obj = {}
if(item?.customEvent?.click) {
let {linkHead, link} = item.customEvent.click
console.log(linkHead, link)
obj = {
click: () => {
console.log(1234, linkHead,link)
@ -11,7 +9,6 @@ const bindEvent = (item:any) => {
}
}
}
console.log(obj)
return obj
}