@@ -4,15 +4,13 @@ import { useRouter } from 'vue-router'
4
4
5
5
import { useStore } from ' @store/global'
6
6
7
- import LLayout from ' @modules/layout/LLayout.vue'
8
- import LToolbar from ' @modules/layout/components/LToolbar.vue'
9
7
import EMarkdown from ' @modules/entry/pages/EMarkdown.vue'
10
8
11
9
import IValue from ' ../components/IValue.vue'
12
10
import Item from ' @core/entities/item'
13
- import { useState } from ' @composables/state'
14
11
import DirectoryEntry from ' @core/entities/directory-entry'
15
12
import { useColumnStore } from ' @modules/column/store'
13
+ import { useLocalStorage } from ' @vueuse/core'
16
14
17
15
// Props & Emit
18
16
const props = defineProps ({
@@ -36,11 +34,16 @@ const router = useRouter()
36
34
37
35
const item = ref <Item >()
38
36
37
+ const loading = ref (false )
38
+
39
39
async function setItem() {
40
+ loading .value = true
41
+
40
42
await store .item
41
43
.show (props .collectionId , props .itemId )
42
44
.then ((r ) => (item .value = r ?? undefined ))
43
45
.catch (() => router .push (' 404' ))
46
+ .finally (() => (loading .value = false ))
44
47
}
45
48
46
49
watch (props , setItem , {
@@ -59,12 +62,10 @@ async function load() {
59
62
}
60
63
}
61
64
62
- watch (() => props .collectionId , load , { deep: true } )
65
+ watch (() => props .collectionId , load )
63
66
64
67
// drawer
65
- const drawer = useState (' app:item-drawer' , true , {
66
- localStorage: true ,
67
- })
68
+ const drawer = useLocalStorage (' app:item-drawer' , true )
68
69
69
70
// content path
70
71
@@ -84,22 +85,29 @@ watch(() => props.itemId, setContentPath, {
84
85
</script >
85
86
<template >
86
87
<v-layout use-percentage >
87
- <v-layout-drawer v-if =" item" v-model =" drawer" class =" border-l border-lines px-4 py-4" right >
88
- <i-value
89
- v-for =" c in columnStore.columns"
90
- :key =" c.id"
91
- :column-id =" c.id"
92
- :collection-id =" collectionId"
93
- :item-id =" item.id"
94
- :label =" c.label"
95
- :type =" c.type"
96
- edit
97
- class =" mb-4 last:mb-0"
98
- />
88
+ <v-layout-drawer :model-value =" drawer" class =" border-l border-lines px-4 py-4" right >
89
+ <div v-if =" item" >
90
+ <i-value
91
+ v-for =" c in columnStore.columns"
92
+ :key =" c.id"
93
+ :column-id =" c.id"
94
+ :collection-id =" collectionId"
95
+ :item-id =" item.id"
96
+ :label =" c.label"
97
+ :type =" c.type"
98
+ edit
99
+ class =" mb-4 last:mb-0"
100
+ />
101
+ </div >
99
102
</v-layout-drawer >
100
103
101
- <v-layout-content v-if =" contentPath" >
102
- <e-markdown ref =" editorRef" :path =" contentPath" :doc:scope =" { item }" >
104
+ <v-layout-content >
105
+ <e-markdown
106
+ v-if =" contentPath"
107
+ ref =" editorRef"
108
+ :path =" contentPath"
109
+ :doc:scope =" { item }"
110
+ >
103
111
<template #append-actions >
104
112
<v-btn mode =" text" size =" sm" @click =" drawer = !drawer" >
105
113
<v-icon name =" cog" />
0 commit comments