Skip to content

Commit 1a5f30d

Browse files
committed
perf: 快捷键修改 增加黑色模式
- 新增黑色模式 跟随utools - 修改快捷键 改为了 ctrl+shift+c - 修复非必填项判断的问题 一个简单 git Commit Message 书写的表单工具
1 parent 2c0b343 commit 1a5f30d

File tree

3 files changed

+39
-17
lines changed

3 files changed

+39
-17
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- 新增黑色模式 跟随utools
2+
- 修改快捷键 改为了 ctrl+shift+c
3+
- 修复非必填项判断的问题
4+
5+
一个简单 git Commit Message 书写的表单工具。

src/App.vue

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,26 @@
1010
<NButton @click="theme = null">浅色</NButton> -->
1111
</template>
1212
<script setup lang="ts">
13-
import { ref } from "vue";
14-
// import {
15-
// NConfigProvider,
16-
// NMessageProvider,
17-
// NCard,
18-
// NButton,
19-
// darkTheme,
20-
// } from "naive-ui";
13+
import { ref, onMounted } from "vue";
14+
import { darkTheme } from "naive-ui";
2115
import Home from "./components/home2.vue";
2216
const theme = ref(null);
17+
const loadFunc = () => {
18+
if (utools.isDarkColors()) {
19+
theme.value = darkTheme;
20+
} else {
21+
theme.value = null;
22+
}
23+
};
24+
let utools = null;
25+
if (window["utools"]) {
26+
utools = window["utools"];
27+
utools.onPluginReady(() => {
28+
console.log("插件装配完成,已准备好");
29+
loadFunc();
30+
});
31+
utools.onPluginEnter(({ code, type, payload }) => {
32+
loadFunc();
33+
});
34+
}
2335
</script>
24-

src/components/home2.vue

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22

33
<template>
4-
<NCard :bordered="false">
4+
<NCard :bordered="false" class="card-class">
55
<NGrid cols="24" item-responsive responsive="screen">
66
<NGridItem span="24 m:12 l:12" offset="0 m:6 l:6">
77
<NSpace vertical>
@@ -37,25 +37,25 @@
3737
<NInput
3838
v-model:value="scope"
3939
size="large"
40-
placeholder="范围"
40+
placeholder="范围(非必填)"
4141
></NInput
4242
></NGridItem>
4343
</NGrid>
4444
<NInput
4545
v-model:value="subject"
4646
size="large"
47-
placeholder="简短描述"
47+
placeholder="简短描述(必填)"
4848
></NInput>
4949

5050
<NInput
5151
v-model:value="body"
5252
type="textarea"
5353
:rows="10"
5454
size="large"
55-
placeholder="具体内容"
55+
placeholder="具体内容(非必填)"
5656
></NInput>
5757
</NSpace>
58-
<NText depth="3">ctrl + alt 快速复制并关闭 </NText>
58+
<NText depth="3">Ctrl + Shift + C 快速复制并关闭 </NText>
5959
<!-- <ElFormItem label="最后">
6060
<NInput v-model="footer" type="textarea"></NInput>
6161
</ElFormItem> -->
@@ -82,7 +82,7 @@ import { useClipboard, useMagicKeys } from "@vueuse/core";
8282
const message = useMessage();
8383
8484
const keys = useMagicKeys();
85-
const shiftCtrlC = keys["Ctrl+Alt"];
85+
const shiftCtrlC = keys["Ctrl+Shift+C"];
8686
8787
watch(shiftCtrlC, (v) => {
8888
if (v) {
@@ -177,7 +177,8 @@ onMounted(() => {
177177
}
178178
});
179179
const handleCopy = async () => {
180-
if (!scope.value) {
180+
if (!subject.value) {
181+
message.error("必填项必填");
181182
return;
182183
}
183184
let content = handleGetContent();
@@ -188,4 +189,9 @@ const handleCopy = async () => {
188189
});
189190
};
190191
</script>
191-
192+
<style scoped>
193+
.card-class {
194+
width: 100%;
195+
height: 100vh;
196+
}
197+
</style>

0 commit comments

Comments
 (0)