mirror of
https://github.com/rubickCenter/rubick
synced 2025-06-22 12:28:19 +08:00
Merge pull request #98 from rubickCenter/feature/hotkey-tips
🚀 添加快捷键修改提示
This commit is contained in:
commit
65932ca22a
@ -25,11 +25,13 @@
|
|||||||
<div class="settings-detail">
|
<div class="settings-detail">
|
||||||
<div v-if="currentSelect[0] === 'normal'">
|
<div v-if="currentSelect[0] === 'normal'">
|
||||||
<div class="setting-item">
|
<div class="setting-item">
|
||||||
<div class="title">
|
<div class="title">快捷键</div>
|
||||||
快捷键(需要使用 option/ctrl/shift/command 键修饰)
|
|
||||||
</div>
|
|
||||||
<div class="settings-item-li">
|
<div class="settings-item-li">
|
||||||
<div class="label">显示/隐藏快捷键</div>
|
<div class="label">显示/隐藏快捷键</div>
|
||||||
|
<a-tooltip placement="top" trigger="click">
|
||||||
|
<template #title>
|
||||||
|
<span>{{ tipText }} </span>
|
||||||
|
</template>
|
||||||
<div
|
<div
|
||||||
class="value"
|
class="value"
|
||||||
tabIndex="-1"
|
tabIndex="-1"
|
||||||
@ -37,6 +39,7 @@
|
|||||||
>
|
>
|
||||||
{{ shortCut.showAndHidden }}
|
{{ shortCut.showAndHidden }}
|
||||||
</div>
|
</div>
|
||||||
|
</a-tooltip>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-item">
|
<div class="setting-item">
|
||||||
@ -73,8 +76,8 @@
|
|||||||
<div>
|
<div>
|
||||||
按下快捷键,自动搜索对应关键字,当关键字结果完全匹配,且结果唯一时,会直接指向该功能。
|
按下快捷键,自动搜索对应关键字,当关键字结果完全匹配,且结果唯一时,会直接指向该功能。
|
||||||
</div>
|
</div>
|
||||||
<h3 style="margin-top: 10px;">示例</h3>
|
<h3 style="margin-top: 10px">示例</h3>
|
||||||
<a-divider style="margin: 5px 0;" />
|
<a-divider style="margin: 5px 0" />
|
||||||
<a-list item-layout="horizontal" :data-source="examples">
|
<a-list item-layout="horizontal" :data-source="examples">
|
||||||
<template #renderItem="{ item }">
|
<template #renderItem="{ item }">
|
||||||
<a-list-item>
|
<a-list-item>
|
||||||
@ -93,9 +96,7 @@
|
|||||||
<div>快捷键</div>
|
<div>快捷键</div>
|
||||||
<a-tooltip placement="top" trigger="click">
|
<a-tooltip placement="top" trigger="click">
|
||||||
<template #title>
|
<template #title>
|
||||||
<span>先按功能键(Ctrl、Shift、Alt、Option、Command),再按其他普通键。或按
|
<span>{{ tipText }}或按 F1-F12 单键 </span>
|
||||||
F1-F12 单键
|
|
||||||
</span>
|
|
||||||
</template>
|
</template>
|
||||||
<div
|
<div
|
||||||
:key="index"
|
:key="index"
|
||||||
@ -128,9 +129,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ToolOutlined, LaptopOutlined, DatabaseOutlined } from "@ant-design/icons-vue";
|
import {
|
||||||
|
ToolOutlined,
|
||||||
|
LaptopOutlined,
|
||||||
|
DatabaseOutlined,
|
||||||
|
} from "@ant-design/icons-vue";
|
||||||
import debounce from "lodash.debounce";
|
import debounce from "lodash.debounce";
|
||||||
import { ref, reactive, watch, toRefs, toRaw } from "vue";
|
import { ref, reactive, watch, toRefs, computed, toRaw } from "vue";
|
||||||
import keycodes from "./keycode";
|
import keycodes from "./keycode";
|
||||||
import Localhost from "./localhost.vue";
|
import Localhost from "./localhost.vue";
|
||||||
|
|
||||||
@ -154,9 +159,14 @@ const state = reactive({
|
|||||||
global: [],
|
global: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const tipText = computed(() => {
|
||||||
|
const optionKeyName = window.rubick.isMacOs() ? "Option、Command" : "Alt";
|
||||||
|
return `先按功能键(Ctrl、Shift、${optionKeyName}),再按其他普通键。`;
|
||||||
|
});
|
||||||
|
|
||||||
const currentSelect = ref(["normal"]);
|
const currentSelect = ref(["normal"]);
|
||||||
|
|
||||||
const {perf, global: defaultGlobal} = remote.getGlobal("OP_CONFIG").get();
|
const { perf, global: defaultGlobal } = remote.getGlobal("OP_CONFIG").get();
|
||||||
|
|
||||||
state.shortCut = perf.shortCut;
|
state.shortCut = perf.shortCut;
|
||||||
state.common = perf.common;
|
state.common = perf.common;
|
||||||
@ -164,14 +174,18 @@ state.local = perf.local;
|
|||||||
state.global = defaultGlobal;
|
state.global = defaultGlobal;
|
||||||
|
|
||||||
const setConfig = debounce(() => {
|
const setConfig = debounce(() => {
|
||||||
remote.getGlobal("OP_CONFIG").set(JSON.parse(JSON.stringify({
|
remote.getGlobal("OP_CONFIG").set(
|
||||||
|
JSON.parse(
|
||||||
|
JSON.stringify({
|
||||||
perf: {
|
perf: {
|
||||||
shortCut: state.shortCut,
|
shortCut: state.shortCut,
|
||||||
common: state.common,
|
common: state.common,
|
||||||
local: state.local,
|
local: state.local,
|
||||||
},
|
},
|
||||||
global: state.global,
|
global: state.global,
|
||||||
})));
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
ipcRenderer.send("re-register");
|
ipcRenderer.send("re-register");
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
||||||
@ -224,7 +238,7 @@ const changeGlobalKey = (e, index) => {
|
|||||||
|
|
||||||
const changeGlobalValue = (index, value) => {
|
const changeGlobalValue = (index, value) => {
|
||||||
state.global[index].value = value;
|
state.global[index].value = value;
|
||||||
}
|
};
|
||||||
|
|
||||||
const addConfig = () => {
|
const addConfig = () => {
|
||||||
state.global.push({
|
state.global.push({
|
||||||
@ -233,11 +247,11 @@ const addConfig = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const {shortCut, common, local, global} = toRefs(state);
|
const { shortCut, common, local, global } = toRefs(state);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
@import '~@/assets/common.less';
|
@import "~@/assets/common.less";
|
||||||
.settings {
|
.settings {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user