mirror of
https://gitee.com/dromara/go-view.git
synced 2025-04-23 09:50:23 +08:00
feat: 新增预览背景图
This commit is contained in:
parent
c2e01b3907
commit
b9b7c75627
@ -18,7 +18,7 @@
|
|||||||
import { PropType, computed } from 'vue'
|
import { PropType, computed } from 'vue'
|
||||||
import { ChartEditStorageType } from '../../index.d'
|
import { ChartEditStorageType } from '../../index.d'
|
||||||
import { chartColors } from '@/settings/chartThemes/index'
|
import { chartColors } from '@/settings/chartThemes/index'
|
||||||
import { useSizeStyle, useComponentStyle } from '../../hooks/useStyle.hook'
|
import { useSizeStyle, useComponentStyle } from '../../utils'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
localStorageInfo: {
|
localStorageInfo: {
|
||||||
|
@ -17,7 +17,7 @@ import { usePreviewScale } from '@/hooks/index'
|
|||||||
import { RenderList } from './components/RenderList/index'
|
import { RenderList } from './components/RenderList/index'
|
||||||
import { ChartEditStorageType } from './index.d'
|
import { ChartEditStorageType } from './index.d'
|
||||||
import { getLocalStorageInfo } from './utils/index'
|
import { getLocalStorageInfo } from './utils/index'
|
||||||
import { useEditCanvasConfigStyle } from './hooks/useStyle.hook'
|
import { useEditCanvasConfigStyle } from './utils'
|
||||||
|
|
||||||
const previewRef = ref()
|
const previewRef = ref()
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
export * from './style'
|
||||||
import { getLocalStorage } from '@/utils'
|
import { getLocalStorage } from '@/utils'
|
||||||
import { StorageEnum } from '@/enums/storageEnum'
|
import { StorageEnum } from '@/enums/storageEnum'
|
||||||
import { ChartEditStorage } from '@/store/modules/chartEditStore/chartEditStore.d'
|
import { ChartEditStorage } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||||
|
@ -16,16 +16,19 @@ export const useSizeStyle = (attr: AttrType, scale?: number) => {
|
|||||||
const sizeStyle = {
|
const sizeStyle = {
|
||||||
width: `${scale ? scale * attr.w : attr.w}px`,
|
width: `${scale ? scale * attr.w : attr.w}px`,
|
||||||
height: `${scale ? scale * attr.h : attr.h}px`,
|
height: `${scale ? scale * attr.h : attr.h}px`,
|
||||||
border: '1px solid red'
|
|
||||||
}
|
}
|
||||||
return sizeStyle
|
return sizeStyle
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useEditCanvasConfigStyle = (canvas: EditCanvasConfigType) => {
|
export const useEditCanvasConfigStyle = (canvas: EditCanvasConfigType) => {
|
||||||
|
// 背景
|
||||||
|
const computedBackground = canvas.selectColor
|
||||||
|
? { background: canvas.background }
|
||||||
|
: { background: `url(${canvas.backgroundImage}) no-repeat center/100% !important` }
|
||||||
return {
|
return {
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
width: canvas.width ? `${canvas.width || 100}px` : '100%',
|
width: canvas.width ? `${canvas.width || 100}px` : '100%',
|
||||||
height: canvas.height ? `${canvas.height}px` : '100%',
|
height: canvas.height ? `${canvas.height}px` : '100%',
|
||||||
border: '1px solid red'
|
...computedBackground
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user