antd 主题需要分别提供主题变量

This commit is contained in:
plightfield 2024-09-11 18:12:13 +08:00
parent cefc25874b
commit 05c283ee49
2 changed files with 106 additions and 96 deletions

View File

@ -1,5 +1,5 @@
import { defineComponent, ref } from 'vue' import { defineComponent, ref } from 'vue'
import { Button, Checkbox, Divider, message, Modal } from 'ant-design-vue' import { Button, Checkbox, ConfigProvider, Divider, message, Modal, theme } from 'ant-design-vue'
import useSearchConfigStore from './useSearchConfigStore' import useSearchConfigStore from './useSearchConfigStore'
import { EditOutlined, DeleteOutlined, PlusOutlined } from '@ant-design/icons-vue' import { EditOutlined, DeleteOutlined, PlusOutlined } from '@ant-design/icons-vue'
import asyncLoader from '@/utils/asyncLoader' import asyncLoader from '@/utils/asyncLoader'
@ -118,6 +118,7 @@ export default defineComponent(() => {
class="w-full h-full bg-white/80 backdrop-blur p-4 flex flex-col select-text" class="w-full h-full bg-white/80 backdrop-blur p-4 flex flex-col select-text"
onContextmenu={(e) => e.stopPropagation()} onContextmenu={(e) => e.stopPropagation()}
> >
<ConfigProvider theme={{ token: theme.defaultAlgorithm(theme.defaultSeed) }}>
<h2 class="text-center tracking-widest font-bold text-xl text-black/80"></h2> <h2 class="text-center tracking-widest font-bold text-xl text-black/80"></h2>
<div class="grid grid-cols-2 gap-4"> <div class="grid grid-cols-2 gap-4">
<Divider></Divider> <Divider></Divider>
@ -126,7 +127,13 @@ export default defineComponent(() => {
<div class="w-full h-0 flex-grow grid grid-cols-2 gap-4"> <div class="w-full h-0 flex-grow grid grid-cols-2 gap-4">
<div class="w-full h-full overflow-auto"> <div class="w-full h-full overflow-auto">
{searchConfig.defaultList.map((el) => ( {searchConfig.defaultList.map((el) => (
<SearchItem key={el.url} url={el.url} icon={el.icon} name={el.name} v-model={el.show} /> <SearchItem
key={el.url}
url={el.url}
icon={el.icon}
name={el.name}
v-model={el.show}
/>
))} ))}
</div> </div>
<div class="w-full h-full flex flex-col"> <div class="w-full h-full flex flex-col">
@ -170,6 +177,7 @@ export default defineComponent(() => {
> >
<SearchAdder selected={showAdder.value as any} /> <SearchAdder selected={showAdder.value as any} />
</Modal> </Modal>
</ConfigProvider>
</div> </div>
) )
}) })

View File

@ -1,7 +1,7 @@
import { defineComponent } from 'vue' import { defineComponent } from 'vue'
import { OhVueIcon, addIcons } from 'oh-vue-icons' import { OhVueIcon, addIcons } from 'oh-vue-icons'
import { MdUpload, FaEye } from 'oh-vue-icons/icons' import { MdUpload, FaEye } from 'oh-vue-icons/icons'
import { message } from 'ant-design-vue' import { ConfigProvider, message, theme } from 'ant-design-vue'
import upload from './upload' import upload from './upload'
import 'viewerjs/dist/viewer.css' import 'viewerjs/dist/viewer.css'
import { api as showViewer } from 'v-viewer' import { api as showViewer } from 'v-viewer'
@ -35,6 +35,7 @@ export default defineComponent({
let input: HTMLInputElement | null = null let input: HTMLInputElement | null = null
return () => ( return () => (
<div> <div>
<ConfigProvider theme={{ token: theme.defaultAlgorithm(theme.defaultSeed) }}>
<input <input
type="file" type="file"
accept=".png,.jpeg,.jpg,.svg" accept=".png,.jpeg,.jpg,.svg"
@ -89,6 +90,7 @@ export default defineComponent({
)} )}
</div> </div>
<div class="text-xs mt-1 text-black/60"> .png, .jpeg, .jpg, .svg</div>{' '} <div class="text-xs mt-1 text-black/60"> .png, .jpeg, .jpg, .svg</div>{' '}
</ConfigProvider>
</div> </div>
) )
} }