From 226c2a92c72edfe138718ecff5efdeae0dd38bef Mon Sep 17 00:00:00 2001
From: plightfield <1207120484@qq.com>
Date: Mon, 9 Sep 2024 18:51:35 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=B7=BB=E5=8A=A0=E4=B8=80?=
=?UTF-8?q?=E4=BD=93=E5=8C=96=EF=BC=8C=E5=BC=82=E6=AD=A5=E5=8A=A0=E8=BD=BD?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=90=9C=E7=B4=A2=E5=BC=95=E6=93=8E=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/layout/header/search/SearchAdder.tsx | 65 ++++++++++++++++++++++
src/layout/header/search/SearchPage.tsx | 71 +++++++++++-------------
2 files changed, 97 insertions(+), 39 deletions(-)
create mode 100644 src/layout/header/search/SearchAdder.tsx
diff --git a/src/layout/header/search/SearchAdder.tsx b/src/layout/header/search/SearchAdder.tsx
new file mode 100644
index 0000000..6a6aea6
--- /dev/null
+++ b/src/layout/header/search/SearchAdder.tsx
@@ -0,0 +1,65 @@
+import { defineComponent, reactive, watch } from 'vue'
+import { Button, Form, Input } from 'ant-design-vue'
+import asyncLoader from '@/utils/asyncLoader'
+import { CheckOutlined } from '@ant-design/icons-vue'
+const ImageUploader = asyncLoader(() => import('@/utils/ImageUploader'))
+
+export default defineComponent({
+ props: {
+ selected: {
+ type: Object,
+ default: () => ({})
+ }
+ },
+ setup(props) {
+ const addState = reactive({
+ name: '',
+ url: '',
+ icon: ''
+ })
+ watch(
+ () => props.selected,
+ (obj) => {
+ if (!obj) {
+ addState.name = ''
+ addState.url = ''
+ addState.icon = ''
+ return
+ }
+ addState.name = obj.name
+ addState.url = obj.url
+ addState.icon = obj.icon
+ },
+ { immediate: true }
+ )
+ return () => (
+
+
+
+
+
+
+
+
+
+
+ }>
+ 确认添加
+
+
+
+ )
+ }
+})
diff --git a/src/layout/header/search/SearchPage.tsx b/src/layout/header/search/SearchPage.tsx
index d7180e5..9f93a88 100644
--- a/src/layout/header/search/SearchPage.tsx
+++ b/src/layout/header/search/SearchPage.tsx
@@ -10,10 +10,10 @@ import {
message,
Modal
} from 'ant-design-vue'
-import useSearchConfigStore from './useSearchConfigStore'
+import useSearchConfigStore, { type SearchInfo } from './useSearchConfigStore'
import { EditOutlined, DeleteOutlined, PlusOutlined, CheckOutlined } from '@ant-design/icons-vue'
import asyncLoader from '@/utils/asyncLoader'
-const ImageUploader = asyncLoader(() => import('@/utils/ImageUploader'))
+const SearchAdder = asyncLoader(() => import('./SearchAdder'))
const SearchItem = defineComponent({
props: {
icon: {
@@ -37,7 +37,7 @@ const SearchItem = defineComponent({
default: false
}
},
- emits: ['update:modelValue'],
+ emits: ['update:modelValue', 'edit'],
setup(props, ctx) {
const searchConfig = useSearchConfigStore()
return () => (
@@ -84,7 +84,19 @@ const SearchItem = defineComponent({
/>
{props.editable && (
<>
- }>
+ }
+ onClick={() => {
+ ctx.emit('edit', {
+ icon: props.icon,
+ name: props.name,
+ url: props.url
+ })
+ }}
+ >
-
-
-
-
-
-
-
-
-
-
-
- }>
- 确认添加
-
-
-
+ {
+ if (!e) {
+ showAdder.value = undefined
+ }
+ }}
+ title="添加搜索引擎"
+ footer={false}
+ >
+