fix: 修改快捷键功能与提示

This commit is contained in:
MTrun 2022-03-22 10:33:40 +08:00
parent 2e038ad7db
commit 2d36600e3b
3 changed files with 17 additions and 12 deletions

View File

@ -4,6 +4,7 @@ import { CreateComponentType } from '@/packages/index.d'
import debounce from 'lodash/debounce'
import cloneDeep from 'lodash/cloneDeep'
import { defaultTheme, globalThemeJson } from '@/settings/chartThemes/index'
import { RequestHttpEnum } from '@/enums/httpEnum'
// 记录记录
import { useChartHistoryStoreStore } from '@/store/modules/chartHistoryStore/chartHistoryStore'
import { HistoryActionTypeEnum, HistoryItemType, HistoryTargetTypeEnum } from '@/store/modules/chartHistoryStore/chartHistoryStore.d'
@ -84,9 +85,10 @@ export const useChartEditStore = defineStore({
// 全局配置
chartThemeSetting: globalThemeJson
},
// 数据请求处理
// 数据请求处理(需存储给后端)
requestConfig: {
requestDataType: RequestDataTypeEnum.STATIC,
requestHttpType: RequestHttpEnum.GET,
requestUrl: undefined,
requestInterval: 10
},

View File

@ -139,23 +139,23 @@ const shortcutKeyOptions = [
value: '1'
},
{
label: 'Delete 删除',
label: 'Alt + Delete 删除',
value: '2'
},
{
label: 'Ctrl + C 复制',
label: 'Alt + C 复制',
value: '3'
},
{
label: 'Ctrl + X 剪切',
label: 'Alt + X 剪切',
value: '4'
},
{
label: 'Ctrl + Z 后退',
label: 'Alt + Z 后退',
value: '5'
},
{
label: 'Ctrl + Shift + Z 前进',
label: 'Alt + Shift + Z 前进',
value: '6'
}
]

View File

@ -21,19 +21,22 @@ const KeyboardHandle = (e: KeyboardEvent) => {
const key = e.key.toLowerCase()
// 删除
if (key === keyboardValue.delete) {
chartEditStore.removeComponentList()
return
}
// if (key === keyboardValue.delete) {
// chartEditStore.removeComponentList()
// return
// }
// 前进
if (e.ctrlKey && e.shiftKey && key == keyboardValue.back) {
if (e.altKey && e.shiftKey && key == keyboardValue.back) {
chartEditStore.setForward()
return
}
if (e.ctrlKey) {
if (e.altKey) {
switch (key) {
// 删除
case keyboardValue.delete: chartEditStore.removeComponentList()
break;
// 复制
case keyboardValue.copy: chartEditStore.setCopy()
break;