mirror of
https://gitee.com/dromara/go-view.git
synced 2025-02-24 16:22:57 +08:00
fix: 修改右键问题
This commit is contained in:
parent
7002e64b8f
commit
f00bd16aaf
@ -12,7 +12,7 @@ import { loadingStart, loadingFinish, loadingError } from '@/utils'
|
|||||||
import throttle from 'lodash/throttle'
|
import throttle from 'lodash/throttle'
|
||||||
|
|
||||||
const chartEditStore = useChartEditStore()
|
const chartEditStore = useChartEditStore()
|
||||||
const { onClickoutside } = useContextMenu()
|
const { onClickOutSide } = useContextMenu()
|
||||||
|
|
||||||
// * 拖拽到编辑区域里
|
// * 拖拽到编辑区域里
|
||||||
export const handleDrag = async (e: DragEvent) => {
|
export const handleDrag = async (e: DragEvent) => {
|
||||||
@ -74,7 +74,7 @@ export const useMouseHandle = () => {
|
|||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
|
||||||
onClickoutside()
|
onClickOutSide()
|
||||||
chartEditStore.setTargetSelectChart(item.id)
|
chartEditStore.setTargetSelectChart(item.id)
|
||||||
const scale = chartEditStore.getEditCanvas.scale
|
const scale = chartEditStore.getEditCanvas.scale
|
||||||
const width = chartEditStore.getEditCanvasConfig.width
|
const width = chartEditStore.getEditCanvasConfig.width
|
||||||
|
@ -127,7 +127,7 @@ const handleContextMenu = (
|
|||||||
// 挑选选项列表
|
// 挑选选项列表
|
||||||
pickOptionsList?: MenuEnum[],
|
pickOptionsList?: MenuEnum[],
|
||||||
// 自定义列表
|
// 自定义列表
|
||||||
defaultOptions?: MenuOptionsItemType[]
|
selfOptions?: MenuOptionsItemType[]
|
||||||
) => {
|
) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
@ -138,7 +138,7 @@ const handleContextMenu = (
|
|||||||
chartEditStore.setRightMenuShow(false)
|
chartEditStore.setRightMenuShow(false)
|
||||||
|
|
||||||
// * 设置默认选项
|
// * 设置默认选项
|
||||||
if(defaultOptions) menuOptions.value = defaultOptions || defaultOptions
|
if(selfOptions) menuOptions.value = selfOptions || defaultOptions
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
menuOptions.value = pickOption(menuOptions.value, defaultNoItemKeys)
|
menuOptions.value = pickOption(menuOptions.value, defaultNoItemKeys)
|
||||||
@ -164,8 +164,12 @@ const handleContextMenu = (
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export const useContextMenu = () => {
|
export const useContextMenu = () => {
|
||||||
|
|
||||||
|
// 设置默认项
|
||||||
|
menuOptions.value = defaultOptions
|
||||||
|
|
||||||
// * 失焦
|
// * 失焦
|
||||||
const onClickoutside = () => {
|
const onClickOutSide = () => {
|
||||||
chartEditStore.setRightMenuShow(false)
|
chartEditStore.setRightMenuShow(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +194,7 @@ export const useContextMenu = () => {
|
|||||||
return {
|
return {
|
||||||
menuOptions,
|
menuOptions,
|
||||||
handleContextMenu,
|
handleContextMenu,
|
||||||
onClickoutside,
|
onClickOutSide,
|
||||||
handleMenuSelect,
|
handleMenuSelect,
|
||||||
mousePosition: chartEditStore.getMousePosition,
|
mousePosition: chartEditStore.getMousePosition,
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
:y="mousePosition.y"
|
:y="mousePosition.y"
|
||||||
:options="menuOptions"
|
:options="menuOptions"
|
||||||
:show="chartEditStore.getRightMenuShow"
|
:show="chartEditStore.getRightMenuShow"
|
||||||
:on-clickoutside="onClickoutside"
|
:on-clickoutside="onClickOutSide"
|
||||||
@select="handleMenuSelect"
|
@select="handleMenuSelect"
|
||||||
></n-dropdown>
|
></n-dropdown>
|
||||||
</template>
|
</template>
|
||||||
@ -67,7 +67,7 @@ const ContentConfigurations = loadAsyncComponent(() =>
|
|||||||
// 右键
|
// 右键
|
||||||
const {
|
const {
|
||||||
menuOptions,
|
menuOptions,
|
||||||
onClickoutside,
|
onClickOutSide,
|
||||||
mousePosition,
|
mousePosition,
|
||||||
handleMenuSelect
|
handleMenuSelect
|
||||||
} = useContextMenu()
|
} = useContextMenu()
|
||||||
|
Loading…
Reference in New Issue
Block a user