From 743d820bc873f7d0230cfa5529b8a55c58cf3920 Mon Sep 17 00:00:00 2001
From: expdsn <18111002318@163.com>
Date: Tue, 19 Nov 2024 18:58:47 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9=E8=AF=A6=E6=83=85?=
=?UTF-8?q?=E7=BC=BA=E5=B0=91=E5=BF=AB=E6=8D=B7=E6=B7=BB=E5=8A=A0=E5=9B=BE?=
=?UTF-8?q?=E6=A0=87=E6=8C=89=E9=92=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/layout/adder/HotAdder.tsx | 31 +++++++++++++++++++++-------
src/layout/grid/BlockWrapper.tsx | 2 +-
src/layout/grid/DirBlock.tsx | 10 ++++++---
src/layout/grid/DirModal.tsx | 35 +++++++++++++++++++++++++++++---
src/layout/grid/LinkBlock.tsx | 7 +++++++
5 files changed, 71 insertions(+), 14 deletions(-)
diff --git a/src/layout/adder/HotAdder.tsx b/src/layout/adder/HotAdder.tsx
index 789acff..c005ff0 100644
--- a/src/layout/adder/HotAdder.tsx
+++ b/src/layout/adder/HotAdder.tsx
@@ -5,6 +5,7 @@ import useLayoutStore from '../useLayoutStore'
import { AddToToken } from './AdderPage'
import { v4 as uuid } from 'uuid'
import useAdderPageStore, { type HotAppType } from './useAdderPageStore'
+import { globalToast } from '@/main'
export const LinkItem = defineComponent({
props: {
@@ -83,8 +84,8 @@ export const LinkItem = defineComponent({
}
)}
onClick={() => {
- layout.addBlock(
- {
+ if (layout.openDir) {
+ layout.state.dir[layout.openDir].list.push({
id: uuid(),
link: props.content.url,
name: props.content.name,
@@ -95,11 +96,27 @@ export const LinkItem = defineComponent({
color: '',
w: 1,
h: 1
- },
- addTo?.value
- )
- if (addTo?.value) {
- layout.state.currentPage = addTo?.value
+ })
+ globalToast.success('添加成功')
+ } else {
+ layout.addBlock(
+ {
+ id: uuid(),
+ link: props.content.url,
+ name: props.content.name,
+ label: props.content.name,
+ icon: props.content.icon,
+ text: '',
+ background: '',
+ color: '',
+ w: 1,
+ h: 1
+ },
+ addTo?.value
+ )
+ if (addTo?.value) {
+ layout.state.currentPage = addTo?.value
+ }
}
}}
>
diff --git a/src/layout/grid/BlockWrapper.tsx b/src/layout/grid/BlockWrapper.tsx
index 0748b65..908202f 100644
--- a/src/layout/grid/BlockWrapper.tsx
+++ b/src/layout/grid/BlockWrapper.tsx
@@ -170,7 +170,7 @@ export default defineComponent({
{props.block.link ? (
props.block.link.startsWith('id:') ? (
// 文件夹
-