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 { 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 { EditOutlined, DeleteOutlined, PlusOutlined } from '@ant-design/icons-vue'
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"
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>
<div class="grid grid-cols-2 gap-4">
<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-full overflow-auto">
{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 class="w-full h-full flex flex-col">
@ -170,6 +177,7 @@ export default defineComponent(() => {
>
<SearchAdder selected={showAdder.value as any} />
</Modal>
</ConfigProvider>
</div>
)
})

View File

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