mirror of
https://gitee.com/dromara/go-view.git
synced 2024-12-02 11:48:36 +08:00
fix: 消除编辑时provide警告
This commit is contained in:
parent
93350f0f6a
commit
2d4bd34e56
@ -83,7 +83,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, computed } from 'vue'
|
import { onMounted, computed, provide } from 'vue'
|
||||||
import { chartColors } from '@/settings/chartThemes/index'
|
import { chartColors } from '@/settings/chartThemes/index'
|
||||||
import { MenuEnum } from '@/enums/editPageEnum'
|
import { MenuEnum } from '@/enums/editPageEnum'
|
||||||
import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.d'
|
import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.d'
|
||||||
@ -91,7 +91,7 @@ import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle,
|
|||||||
import { useContextMenu } from '@/views/chart/hooks/useContextMenu.hook'
|
import { useContextMenu } from '@/views/chart/hooks/useContextMenu.hook'
|
||||||
import { MenuOptionsItemType } from '@/views/chart/hooks/useContextMenu.hook.d'
|
import { MenuOptionsItemType } from '@/views/chart/hooks/useContextMenu.hook.d'
|
||||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
|
import { SCALE_KEY } from '@/views/preview/hooks/useScale.hook'
|
||||||
import { useLayout } from './hooks/useLayout.hook'
|
import { useLayout } from './hooks/useLayout.hook'
|
||||||
import { useAddKeyboard } from '../hooks/useKeyboard.hook'
|
import { useAddKeyboard } from '../hooks/useKeyboard.hook'
|
||||||
import { dragHandle, dragoverHandle, mousedownHandleUnStop, useMouseHandle } from './hooks/useDrag.hook'
|
import { dragHandle, dragoverHandle, mousedownHandleUnStop, useMouseHandle } from './hooks/useDrag.hook'
|
||||||
@ -108,6 +108,9 @@ import { EditTools } from './components/EditTools'
|
|||||||
const chartEditStore = useChartEditStore()
|
const chartEditStore = useChartEditStore()
|
||||||
const { handleContextMenu } = useContextMenu()
|
const { handleContextMenu } = useContextMenu()
|
||||||
|
|
||||||
|
// 编辑时注入scale变量,消除警告
|
||||||
|
provide(SCALE_KEY, null);
|
||||||
|
|
||||||
// 布局处理
|
// 布局处理
|
||||||
useLayout()
|
useLayout()
|
||||||
|
|
||||||
|
@ -15,7 +15,9 @@ export const useScale = (localStorageInfo: ChartEditStorageType) => {
|
|||||||
provide(SCALE_KEY, scaleRef);
|
provide(SCALE_KEY, scaleRef);
|
||||||
|
|
||||||
const updateScaleRef = (scale: { width: number; height: number }) => {
|
const updateScaleRef = (scale: { width: number; height: number }) => {
|
||||||
scaleRef.value = scale
|
// 这里需要解构,保证赋值给scaleRef的为一个新对象
|
||||||
|
// 因为scale始终为同一引用
|
||||||
|
scaleRef.value = { ...scale }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 屏幕适配
|
// 屏幕适配
|
||||||
|
Loading…
Reference in New Issue
Block a user