Skip to content

Commit 3b3e91c

Browse files
authored
Merge pull request #264 from devforth/docs-for-jsonviewer-component
feat: Add JsonViewer documentation and example
2 parents 3440236 + 7d370e4 commit 3b3e91c

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

adminforth/documentation/docs/tutorial/03-Customization/15-afcl.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,3 +1726,40 @@ import { MixedChart } from '@/afcl'
17261726
</div>
17271727
</div>
17281728

1729+
## Json Viever
1730+
1731+
```ts
1732+
import { JsonViever } from '@/afcl'
1733+
```
1734+
1735+
### Basic
1736+
1737+
<div class="split-screen" >
1738+
1739+
<div>
1740+
```html
1741+
<JsonViewer
1742+
:value="[
1743+
{
1744+
id: 1,
1745+
name: 'Alice',
1746+
meta: {
1747+
age: 30,
1748+
hobbies: ['reading', 'biking'],
1749+
}
1750+
},
1751+
{
1752+
id: 2,
1753+
name: 'Bob',
1754+
}
1755+
]"
1756+
:expandDepth="2"
1757+
/>
1758+
```
1759+
</div>
1760+
<div>
1761+
![Mixed Chart](image-93.png)
1762+
</div>
1763+
</div>
1764+
1765+
8.48 KB
Loading

adminforth/spa/src/afcl/JsonViewer.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,21 @@
55
:expandDepth="expandDepth"
66
copyable
77
sort
8+
:theme="currentTheme"
89
/>
910
</template>
1011

1112
<script setup lang="ts">
13+
import { computed } from 'vue'
1214
import { JsonViewer } from 'vue3-json-viewer'
15+
import { useCoreStore } from '@/stores/core'
1316
1417
defineProps<{
1518
value: any
1619
expandDepth?: number
1720
}>()
1821
22+
const coreStore = useCoreStore()
23+
24+
const currentTheme = computed(() => (coreStore.theme === 'dark' ? 'dark' : 'light'))
1925
</script>

0 commit comments

Comments
 (0)