From cc46aafb3b974e9de6f87ec7968d8e0d97f4904b Mon Sep 17 00:00:00 2001 From: expdsn <18111002318@163.com> Date: Fri, 15 Nov 2024 18:11:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BD=91=E5=9D=80=E5=AF=BC?= =?UTF-8?q?=E8=88=AA-=E8=87=AA=E5=AE=9A=E4=B9=89=E7=BD=91=E5=9D=80?= =?UTF-8?q?=E5=AF=BC=E8=88=AA-=E6=96=87=E5=AD=97=E5=92=8C=E8=83=8C?= =?UTF-8?q?=E6=99=AF=E9=80=89=E6=8B=A9=E6=A0=B7=E5=BC=8F=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=88=E5=8F=82=E8=80=83=E5=A4=87=E6=B3=A8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/adder/CustomAdder.tsx | 99 +++++++-------- src/utils/NativeColorPicker.tsx | 200 ++++++++++++++++--------------- src/utils/ThemeProvider.tsx | 1 + 3 files changed, 157 insertions(+), 143 deletions(-) diff --git a/src/layout/adder/CustomAdder.tsx b/src/layout/adder/CustomAdder.tsx index bfa3726..0e1c11a 100644 --- a/src/layout/adder/CustomAdder.tsx +++ b/src/layout/adder/CustomAdder.tsx @@ -15,6 +15,7 @@ import { AddToToken } from './AdderPage' import DefaultImg from '/tab/icons/bgGameCloud.png' import useAdderPageStore, { type EditBlockItemType } from './useAdderPageStore' import useRouterStore from '@/useRouterStore' +import NativeColorPicker from '@/utils/NativeColorPicker' addIcons(MdUpload, MdImage, MdCheck) const TypeSelector = defineComponent({ @@ -171,6 +172,20 @@ export default defineComponent(() => { if (val.name) form.name = val.name if (val.icon) form.icon = val.icon }) + watch( + () => form.type, + (cur, pre) => { + if (cur === 1) { + if (!form.name) { + globalToast.error('文字图标请至少填写文字或者名称') + form.type = pre + return + } else { + form.text = form.name.substring(0, 2).toLocaleUpperCase() + } + } + } + ) const addTo = inject(AddToToken) return () => (