Skip to content

Commit c65d7f7

Browse files
committed
perf: 作业编辑使用 form
1 parent 719f1ae commit c65d7f7

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

Diff for: package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@
1616
"devDependencies": {
1717
"@vitejs/plugin-vue": "^2.2.4",
1818
"@vueuse/core": "^8.2.3",
19+
"dayjs": "^1.11.0",
1920
"electron": "^17.2.0",
2021
"electron-builder": "^22.14.5",
2122
"naive-ui": "^2.26.1",
2223
"typescript": "^4.5.5",
24+
"unplugin-vue-components": "^0.18.5",
2325
"vite": "^2.7.13",
2426
"vite-plugin-resolve": "^1.4.4",
2527
"vue": "^3.2.29",
2628
"vue-router": "^4.0.13",
2729
"vue-tsc": "^0.31.1",
28-
"win-win-api": "^0.0.5",
29-
"dayjs": "^1.11.0",
30-
"unplugin-vue-components": "^0.18.5"
30+
"win-win-api": "^0.0.5"
3131
},
3232
"env": {
3333
"PORT": 3344

Diff for: src/renderer/components.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
declare module 'vue' {
66
export interface GlobalComponents {
7+
NForm: typeof import('naive-ui')['NForm']
8+
NFormItem: typeof import('naive-ui')['NFormItem']
79
NGi: typeof import('naive-ui')['NGi']
810
NGrid: typeof import('naive-ui')['NGrid']
911
NInput: typeof import('naive-ui')['NInput']

Diff for: src/renderer/src/views/Homework.vue

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
<script setup lang="ts">
2+
import locale from '../language/zh_CN.json'
23
import useHomeworks from '../stores/homeworks';
34
45
const homeworks = useHomeworks();
56
67
</script>
78

89
<template>
9-
<div v-for="(homework, subject) in homeworks">
10-
<p><n-input type="text" v-model:value="homeworks[subject]"/></p>
11-
</div>
10+
<n-form
11+
label-placement="left"
12+
label-width="auto"
13+
>
14+
<n-form-item
15+
v-for="(homework, subject) in homeworks"
16+
:label="locale.subject[subject]"
17+
>
18+
<n-input type="text" v-model:value="homeworks[subject]"/>
19+
</n-form-item>
20+
</n-form>
1221
</template>

0 commit comments

Comments
 (0)