Skip to content

Commit 12ebb30

Browse files
committed
feat(Home): 🚸 同步正式版的快捷键
Ctrl/Command+Alt
1 parent ba51cf9 commit 12ebb30

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

src/components/home.vue

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
placeholder="具体内容(非必填)"
5555
></NInput>
5656
</NSpace>
57-
<NText depth="3">Ctrl + Shift + C 快速复制并关闭 </NText>
57+
<NText depth="3">Ctrl /Command + Alt 快速复制并关闭 </NText>
5858
<!-- <ElFormItem label="最后">
5959
<NInput v-model="footer" type="textarea"></NInput>
6060
</ElFormItem> -->
@@ -66,14 +66,24 @@
6666
import { useMessage} from "naive-ui";
6767
const message = useMessage();
6868
69-
const keys = useMagicKeys();
70-
const shiftCtrlC = keys["Ctrl+Shift+C"];
69+
const { ctrl_alt } = useMagicKeys();
7170
72-
watch(shiftCtrlC, (v) => {
73-
if (v) {
74-
handleCopy();
71+
whenever(ctrl_alt, () => {
72+
handleCopy()
73+
} )
74+
75+
const handleCopy = async () => {
76+
if (!subject.value) {
77+
message.error("必填项必填");
78+
return;
7579
}
76-
});
80+
let content = handleGetContent();
81+
await copy(content);
82+
message.success("复制成功");
83+
nextTick(() => {
84+
utools && utools.hideMainWindow();
85+
});
86+
};
7787
// https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/config-conventional/index.js
7888
// TODO 后期引入默认emoji
7989
// TODO 后期引入国际化
@@ -182,18 +192,7 @@ onMounted(() => {
182192
utools = window["utools"];
183193
}
184194
});
185-
const handleCopy = async () => {
186-
if (!subject.value) {
187-
message.error("必填项必填");
188-
return;
189-
}
190-
let content = handleGetContent();
191-
await copy(content);
192-
message.success("复制成功");
193-
nextTick(() => {
194-
utools && utools.hideMainWindow();
195-
});
196-
};
195+
197196
</script>
198197
<style scoped>
199198
.card-class {

0 commit comments

Comments
 (0)