File tree Expand file tree Collapse file tree 2 files changed +26
-14
lines changed Expand file tree Collapse file tree 2 files changed +26
-14
lines changed Original file line number Diff line number Diff line change @@ -351,7 +351,7 @@ function processProps (instance) {
351
351
const prop = props [ key ]
352
352
const options = prop . options
353
353
return {
354
- type : 'prop ' ,
354
+ type : 'props ' ,
355
355
key : prop . path ,
356
356
value : instance [ prop . path ] ,
357
357
meta : {
@@ -367,7 +367,7 @@ function processProps (instance) {
367
367
const prop = props [ key ]
368
368
key = camelize ( key )
369
369
return {
370
- type : 'prop ' ,
370
+ type : 'props ' ,
371
371
key,
372
372
value : instance [ key ] ,
373
373
meta : {
@@ -439,7 +439,7 @@ function processComputed (instance) {
439
439
for ( const key in defs ) {
440
440
const def = defs [ key ]
441
441
const type = typeof def === 'function' && def . vuex
442
- ? 'vuex'
442
+ ? 'vuex bindings '
443
443
: 'computed'
444
444
// use try ... catch here because some computed properties may
445
445
// throw error during its evaluation
@@ -503,7 +503,7 @@ function processVuexGetters (instance) {
503
503
if ( getters ) {
504
504
return Object . keys ( getters ) . map ( key => {
505
505
return {
506
- type : 'vuex getter ' ,
506
+ type : 'vuex getters ' ,
507
507
key,
508
508
value : instance [ key ]
509
509
}
@@ -525,7 +525,7 @@ function processFirebaseBindings (instance) {
525
525
if ( refs ) {
526
526
return Object . keys ( refs ) . map ( key => {
527
527
return {
528
- type : 'firebase' ,
528
+ type : 'firebase bindings ' ,
529
529
key,
530
530
value : instance [ key ]
531
531
}
@@ -547,7 +547,7 @@ function processObservables (instance) {
547
547
if ( obs ) {
548
548
return Object . keys ( obs ) . map ( key => {
549
549
return {
550
- type : 'observable ' ,
550
+ type : 'observables ' ,
551
551
key,
552
552
value : instance [ key ]
553
553
}
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div class =" data-wrapper" >
3
- <div v-for =" type in Object.keys (state)" :class =" ['data-el', toDisplayType(type)]" >
4
- <div class =" data-type" >{{ toDisplayType(type, true ) }}</div >
3
+ <div v-for =" type in getKeys (state)" :class =" ['data-el', toDisplayType(type)]" >
4
+ <div class =" data-type" >{{ toDisplayType(type) }}</div >
5
5
<div class =" data-fields" >
6
6
<template v-if =" Array .isArray (state [type ])" >
7
7
<data-field
27
27
<script >
28
28
import DataField from ' ./DataField.vue'
29
29
30
+ const keyOrder = {
31
+ undefined : 1 ,
32
+ props: 2 ,
33
+ computed: 3 ,
34
+ state: 1 ,
35
+ getters: 2
36
+ }
37
+
30
38
export default {
31
39
props: [' state' ],
32
40
components: {
33
41
DataField
34
42
},
35
43
methods: {
36
- toDisplayType (type , full ) {
44
+ getKeys (state ) {
45
+ return Object .keys (state).sort ((a , b ) => {
46
+ return (
47
+ (keyOrder[a] || (a .charCodeAt (0 ) + 999 )) -
48
+ (keyOrder[b] || (b .charCodeAt (0 ) + 999 ))
49
+ )
50
+ })
51
+ },
52
+ toDisplayType (type ) {
37
53
return type === ' undefined'
38
54
? ' data'
39
- : full
40
- ? (type === ' vuex' || type === ' firebase' )
41
- ? type + ' bindings'
42
- : type
43
- : type
55
+ : type
44
56
}
45
57
}
46
58
}
You can’t perform that action at this time.
0 commit comments