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 () => ( +
{ + console.log(res) + }} + > + + + + + + + + + + + + +
+ ) + } +}) 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 && ( <> - + - -
{ - console.log(res) - }} - > - - - - - - - - - - - - -
+ { + if (!e) { + showAdder.value = undefined + } + }} + title="添加搜索引擎" + footer={false} + > +