Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 7adef11

Browse files
committed
关闭表单校验
1 parent 2f289f1 commit 7adef11

File tree

1 file changed

+4
-33
lines changed

1 file changed

+4
-33
lines changed

src/pages/config/index.vue

+4-33
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<script lang="ts" setup>
2-
import type { FormInstance, FormRules } from 'element-plus';
3-
import { ElMessage } from 'element-plus';
42
import ProgramItem from './components/ProgramItem.vue';
53
import DownloaderItem from './components/DownloaderItem.vue';
64
import RssParserItem from './components/RssParserItem.vue';
@@ -10,33 +8,11 @@ import ProxyItem from './components/ProxyItem.vue';
108
import NotificationItem from './components/NotificationItem.vue';
119
1210
import { form } from './form-data';
13-
import { useConfigCheck } from './useConfigCheck';
1411
1512
const store = configStore();
16-
const { validtePort, validteHost, validteFormProxy } = useConfigCheck();
17-
const ruleFormRef = ref<FormInstance>();
1813
19-
const rules = reactive<FormRules>({
20-
'program.webui_port': [{ validator: validtePort, trigger: 'blur' }],
21-
'downloader.host': [{ validator: validteHost, trigger: 'blur' }],
22-
23-
'proxy.host': [{ validator: validteFormProxy.ip, trigger: 'blur' }],
24-
'proxy.port': [{ validator: validteFormProxy.port, trigger: 'blur' }],
25-
});
26-
27-
function submit(formEl: FormInstance | undefined) {
28-
if (!formEl) return false;
29-
formEl.validate((valid) => {
30-
if (valid) {
31-
store.set(form);
32-
} else {
33-
ElMessage({
34-
message: '配置验证失败! 请检查你的配置',
35-
type: 'error',
36-
});
37-
return false;
38-
}
39-
});
14+
function submit() {
15+
store.set(form);
4016
}
4117
4218
function formSync() {
@@ -59,12 +35,7 @@ onActivated(async () => {
5935
<section class="settings" pb30>
6036
<el-row :gutter="20">
6137
<el-col :xs="24" :sm="24">
62-
<el-form
63-
ref="ruleFormRef"
64-
:model="form"
65-
:rules="rules"
66-
label-position="right"
67-
>
38+
<el-form :model="form" label-position="right">
6839
<el-collapse>
6940
<ProgramItem />
7041
<DownloaderItem />
@@ -79,7 +50,7 @@ onActivated(async () => {
7950
</el-row>
8051

8152
<div flex="~ items-center justify-center" mt20>
82-
<el-button type="primary" @click="submit(ruleFormRef)">保存</el-button>
53+
<el-button type="primary" @click="submit">保存</el-button>
8354
<el-button @click="formSync">还原</el-button>
8455
</div>
8556
</section>

0 commit comments

Comments
 (0)