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