File tree Expand file tree Collapse file tree 6 files changed +6217
-5751
lines changed
Expand file tree Collapse file tree 6 files changed +6217
-5751
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 1+ <script setup>
2+ function refresh () {
3+ location .reload ()
4+ }
5+
6+ </script >
7+
8+ <template >
9+ <button class =" reset" @click =" refresh" >RESET</button >
10+ <h1 ><slot name =" title" /></h1 >
11+ <div class =" box" >
12+ <div style =" width :100% " >
13+ <p >Local</p >
14+ <slot name =" local" />
15+ </div >
16+ <div style =" width :100% " >
17+ <p >VueDataUi Local</p >
18+ <slot name =" VDUI-local" />
19+ </div >
20+ <div style =" width : 100% " >
21+ <p >Build</p >
22+ <slot name =" build" />
23+ </div >
24+ <div style =" width : 100% " >
25+ <p >VueDataUi build</p >
26+ <slot name =" VDUI-build" />
27+ </div >
28+ </div >
29+ <div style =" width : calc (100% - 48px ); margin-top : 24px ;padding : 0 24px " >
30+ <button class =" reset" @click =" refresh" >RESET</button >
31+ <slot name =" knobs" />
32+ </div >
33+
34+ <div class =" config" >
35+ <code >
36+ <slot name =" config" />
37+ </code >
38+ </div >
39+ </template >
40+
41+ <style scoped>
42+ h1 , p {
43+ color : #CCCCCC ;
44+ }
45+ .box {
46+ display : grid ;
47+ grid-template-columns : repeat (2 , 1fr );
48+ gap : 12px ;
49+ width : 100% ;
50+ }
51+ .config {
52+ color : #CCCCCC ;
53+ margin : 24px 0 ;
54+ padding : 0 24px ;
55+ }
56+ .reset {
57+ background : #ff6400 ;
58+ color : white ;
59+ border : none ;
60+ padding : 6px 12px ;
61+ border-radius : 3px ;
62+ margin : 12px 0 ;
63+ }
64+ code {
65+ color : #42d392 ;
66+ }
67+ </style >
Original file line number Diff line number Diff line change 1+ export default function convertArrayToObject ( configArray ) {
2+ const resultObject = { } ;
3+
4+ configArray . forEach ( ( { key, def } ) => {
5+ const keys = key . split ( '.' ) ;
6+ let currentObject = resultObject ;
7+
8+ keys . forEach ( ( nestedKey , index ) => {
9+ if ( ! currentObject . hasOwnProperty ( nestedKey ) ) {
10+ if ( index === keys . length - 1 ) {
11+ currentObject [ nestedKey ] = def ;
12+ } else {
13+ currentObject [ nestedKey ] = { } ;
14+ }
15+ }
16+ currentObject = currentObject [ nestedKey ] ;
17+ } ) ;
18+ } ) ;
19+
20+ return resultObject ;
21+ }
You can’t perform that action at this time.
0 commit comments