瀏覽代碼

Merge pull request #18 from snowords/master

fix bug
Archer 3 年之前
父節點
當前提交
7c1ea593fb
共有 2 個文件被更改,包括 7 次插入28 次删除
  1. 0 20
      .pnpm-debug.log
  2. 7 8
      src/components/Search/src/Search.vue

+ 0 - 20
.pnpm-debug.log

@@ -1,20 +0,0 @@
-{
-  "0 debug pnpm:scope": {
-    "selected": 1
-  },
-  "1 error pnpm": {
-    "errno": 1,
-    "code": "ELIFECYCLE",
-    "pkgid": "element-plus-admin@3.0.0",
-    "stage": "clean",
-    "script": "npx rimraf docs/node_modules && npx rimraf node_modules",
-    "pkgname": "element-plus-admin",
-    "err": {
-      "name": "pnpm",
-      "message": "element-plus-admin@3.0.0 clean: `npx rimraf docs/node_modules && npx rimraf node_modules`\nExit status 1",
-      "code": "ELIFECYCLE",
-      "stack": "pnpm: element-plus-admin@3.0.0 clean: `npx rimraf docs/node_modules && npx rimraf node_modules`\nExit status 1\n    at EventEmitter.<anonymous> (C:\\Users\\admin\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\registry.npmmirror.com+pnpm@6.25.1\\node_modules\\pnpm\\dist\\pnpm.cjs:104843:20)\n    at EventEmitter.emit (events.js:315:20)\n    at ChildProcess.<anonymous> (C:\\Users\\admin\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\registry.npmmirror.com+pnpm@6.25.1\\node_modules\\pnpm\\dist\\pnpm.cjs:91921:18)\n    at ChildProcess.emit (events.js:315:20)\n    at maybeClose (internal/child_process.js:1048:16)\n    at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)"
-    }
-  },
-  "2 warn pnpm:global": " Local package.json exists, but node_modules missing, did you mean to install?"
-}

+ 7 - 8
src/components/Search/src/Search.vue

@@ -63,14 +63,13 @@ const newSchema = computed(() => {
 const { register, elFormRef, methods } = useForm()
 
 const search = async () => {
-  const res = await unref(elFormRef)
-    ?.validate()
-    ?.catch(() => {})
-  if (res) {
-    const { getFormData } = methods
-    const model = await getFormData()
-    emit('search', model)
-  }
+  await unref(elFormRef)?.validate(async (isValid) => {
+    if (isValid) {
+      const { getFormData } = methods
+      const model = await getFormData()
+      emit('search', model)
+    }
+  })
 }
 
 const reset = async () => {