|
1 | 1 |
|
2 | 2 |
|
3 | 3 | <template> |
4 | | - <div class="w-full p-2"> |
5 | | - <ElRow :gutter="0"> |
6 | | - <ElCol |
7 | | - :xs="{ |
8 | | - span: 24, |
9 | | - }" |
10 | | - :sm="{ |
11 | | - span: 24, |
12 | | - }" |
13 | | - :md="{ |
14 | | - span: 24, |
15 | | - }" |
16 | | - :lg="{ |
17 | | - span: 12, |
18 | | - offset: 6, |
19 | | - }" |
20 | | - :xl="{ |
21 | | - span: 10, |
22 | | - offset: 7, |
23 | | - }" |
24 | | - > |
25 | | - <div class="text-right p-2"> |
26 | | - <ElButton type="warning" size="small" @click="handleClear" |
27 | | - >重置内容</ElButton |
28 | | - > |
29 | | - <ElButton |
30 | | - type="success" |
31 | | - size="small" |
32 | | - :disabled="copyDisabled" |
33 | | - @click="copy(content)" |
34 | | - ><span v-if="!copied">复制结果</span> |
35 | | - <span v-else>已复制</span></ElButton |
36 | | - > |
37 | | - </div> |
38 | | - <div class="flex justify-center items-center"> |
39 | | - <div class="mx-2"> |
40 | | - <ElSelect |
41 | | - v-model="type" |
42 | | - placeholder="Select" |
43 | | - size="large" |
44 | | - > |
45 | | - <ElOption |
46 | | - v-for="item in typeOptions" |
47 | | - :key="item.value" |
48 | | - :label="item.label + '(' + item.value + ')'" |
49 | | - :value="item.value" |
50 | | - > |
51 | | - </ElOption> |
52 | | - </ElSelect> |
53 | | - </div> |
54 | | - |
55 | | - <div class="mx-2 w-full"> |
56 | | - <ElInput v-model="scope" size="large"></ElInput> |
57 | | - </div> |
58 | | - </div> |
59 | | - <div class="p-2"> |
60 | | - <ElInput v-model="subject" size="large"></ElInput> |
61 | | - </div> |
62 | | - <div class="p-2"> |
63 | | - <ElInput |
64 | | - v-model="body" |
65 | | - type="textarea" |
66 | | - :rows="10" |
67 | | - size="large" |
68 | | - ></ElInput> |
69 | | - </div> |
70 | | - |
71 | | - <!-- <ElFormItem label="最后"> |
72 | | - <ElInput v-model="footer" type="textarea"></ElInput> |
73 | | - </ElFormItem> --> |
74 | | - |
75 | | - <div class="py-2"> |
76 | | - <div class="text-right"></div> |
77 | | - </div> |
78 | | - </ElCol> |
79 | | - </ElRow> |
80 | | - </div> |
| 4 | + <NConfigProvider :theme="theme"> |
| 5 | + <NMessageProvider> |
| 6 | + <Home /> |
| 7 | + </NMessageProvider> |
| 8 | + </NConfigProvider> |
| 9 | + <!-- <NButton @click="theme = darkTheme">深色</NButton> |
| 10 | + <NButton @click="theme = null">浅色</NButton> --> |
81 | 11 | </template> |
82 | 12 | <script setup lang="ts"> |
83 | | -import { ref, computed } from "vue"; |
84 | | -import { |
85 | | - ElRow, |
86 | | - ElCol, |
87 | | - ElForm, |
88 | | - ElFormItem, |
89 | | - ElSelect, |
90 | | - ElOption, |
91 | | - ElButton, |
92 | | - ElInput, |
93 | | -} from "element-plus"; |
94 | | -import { useClipboard } from "@vueuse/core"; |
95 | | -const typeOptions = ref([ |
96 | | - { |
97 | | - value: "feat", |
98 | | - label: "新功能", |
99 | | - }, |
100 | | - { |
101 | | - value: "fix", |
102 | | - label: "修补bug", |
103 | | - }, |
104 | | - { |
105 | | - value: "docs", |
106 | | - label: "文档", |
107 | | - }, |
108 | | - { |
109 | | - value: "style", |
110 | | - label: "格式", |
111 | | - }, |
112 | | - { |
113 | | - value: "refactor", |
114 | | - label: "重构", |
115 | | - }, |
116 | | - { |
117 | | - value: "perf", |
118 | | - label: "性能 体验优化", |
119 | | - }, |
120 | | - { |
121 | | - value: "test", |
122 | | - label: "增加 更新测试", |
123 | | - }, |
124 | | -]); |
125 | | -// 类型 |
126 | | -const type = ref("feat"); |
127 | | -// 范围 |
128 | | -const scope = ref(""); |
129 | | -// 简短描述 |
130 | | -const subject = ref(""); |
131 | | -
|
132 | | -// body |
133 | | -const body = ref(""); |
134 | | -
|
135 | | -// 最后 |
136 | | -const footer = ref(""); |
137 | | -
|
138 | | -const content = computed(() => { |
139 | | - let commit = ""; |
140 | | - commit += type.value; |
141 | | - if (scope.value) { |
142 | | - commit += "(" + scope.value + ")"; |
143 | | - } |
144 | | - commit += ": " + subject.value; |
145 | | -
|
146 | | - if (body.value) { |
147 | | - commit += "\r\n\r\n" + body.value + "\r\n\r\n"; |
148 | | - } |
149 | | - return commit; |
150 | | -}); |
151 | | -const copyDisabled = computed((): boolean => { |
152 | | - return type.value && subject.value ? false : true; |
153 | | -}); |
154 | | -const { text, copy, copied, isSupported } = useClipboard({ |
155 | | - source: content, |
156 | | -}); |
157 | | -const handleClear = () => { |
158 | | - subject.value = ""; |
159 | | - scope.value = ""; |
160 | | - body.value = ""; |
161 | | - type.value = typeOptions.value[0].value; |
162 | | -}; |
| 13 | +import { ref } from "vue"; |
| 14 | +// import { |
| 15 | +// NConfigProvider, |
| 16 | +// NMessageProvider, |
| 17 | +// NCard, |
| 18 | +// NButton, |
| 19 | +// darkTheme, |
| 20 | +// } from "naive-ui"; |
| 21 | +import Home from "./components/home2.vue"; |
| 22 | +const theme = ref(null); |
163 | 23 | </script> |
164 | | -<style lang="less" scoped> |
165 | | -</style> |
166 | 24 |
|
0 commit comments