File tree Expand file tree Collapse file tree 3 files changed +32
-2
lines changed
Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Original file line number Diff line number Diff line change 11<script setup lang='ts'>
22import { List } from ' lucide-vue-next'
33import { useRenderStore } from ' @/stores/render'
4+ import { useUIStore } from ' @/stores/ui'
45
56const renderStore = useRenderStore ()
7+ const uiStore = useUIStore ()
8+ const { isPinFloatingToc } = storeToRefs (uiStore )
69
710const isOpenHeadingSlider = ref (false )
811 </script >
@@ -17,8 +20,8 @@ const isOpenHeadingSlider = ref(false)
1720 <ul
1821 class =" overflow-auto transition-all"
1922 :class =" {
20- 'max-h-0 w-0': !isOpenHeadingSlider,
21- 'max-h-100 w-60 mt-2': isOpenHeadingSlider,
23+ 'max-h-0 w-0': !isOpenHeadingSlider && !isPinFloatingToc ,
24+ 'max-h-100 w-60 mt-2': isOpenHeadingSlider || isPinFloatingToc ,
2225 }"
2326 >
2427 <li
Original file line number Diff line number Diff line change @@ -100,6 +100,27 @@ function customStyle() {
100100 </Button >
101101 </div >
102102 </div >
103+ <div class =" space-y-2" >
104+ <h2 class =" text-sm font-medium" >
105+ 浮动目录
106+ </h2 >
107+ <div class =" grid grid-cols-2 justify-items-center gap-2" >
108+ <Button
109+ class =" w-full" variant =" outline" :class =" {
110+ 'border-black dark:border-white border-2': uiStore.isPinFloatingToc,
111+ }" @click =" !uiStore.isPinFloatingToc && uiStore.togglePinFloatingToc()"
112+ >
113+ 常驻显示
114+ </Button >
115+ <Button
116+ class =" w-full" variant =" outline" :class =" {
117+ 'border-black dark:border-white border-2': !uiStore.isPinFloatingToc,
118+ }" @click =" uiStore.isPinFloatingToc && uiStore.togglePinFloatingToc()"
119+ >
120+ 移入触发
121+ </Button >
122+ </div >
123+ </div >
103124 <div class =" space-y-2" >
104125 <h2 class =" text-sm font-medium" >
105126 模式
Original file line number Diff line number Diff line change @@ -30,6 +30,10 @@ export const useUIStore = defineStore(`ui`, () => {
3030 // 是否为移动端
3131 const isMobile = store . reactive ( `isMobile` , false )
3232
33+ // 是否固定显示浮动目录
34+ const isPinFloatingToc = store . reactive ( addPrefix ( `isPinFloatingToc` ) , false )
35+ const togglePinFloatingToc = useToggle ( isPinFloatingToc )
36+
3337 // ==================== 对话框状态 ====================
3438 // 是否展示 CSS 编辑器
3539 const isShowCssEditor = store . reactive ( `isShowCssEditor` , false )
@@ -86,6 +90,7 @@ export const useUIStore = defineStore(`ui`, () => {
8690 isOpenRightSlider,
8791 isOpenPostSlider,
8892 isMobile,
93+ isPinFloatingToc,
8994
9095 // ==================== 对话框状态 ====================
9196 isShowCssEditor,
@@ -106,5 +111,6 @@ export const useUIStore = defineStore(`ui`, () => {
106111 toggleDark,
107112 toggleEditOnLeft,
108113 toggleAIToolbox,
114+ togglePinFloatingToc,
109115 }
110116} )
You can’t perform that action at this time.
0 commit comments