Skip to content

Commit ddd8a94

Browse files
committed
display vuex bindings
1 parent 4ae0973 commit ddd8a94

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/backend/index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,23 +431,28 @@ function processState (instance) {
431431

432432
function processComputed (instance) {
433433
const computed = []
434+
const defs = instance.$options.computed || {}
434435
// use for...in here because if 'computed' is not defined
435436
// on component, computed properties will be placed in prototype
436437
// and Object.keys does not include
437438
// properties from object's prototype
438-
for (const key in (instance.$options.computed || {})) {
439+
for (const key in defs) {
440+
const def = defs[key]
441+
const type = typeof def === 'function' && def.vuex
442+
? 'vuex'
443+
: 'computed'
439444
// use try ... catch here because some computed properties may
440445
// throw error during its evaluation
441446
let computedProp = null
442447
try {
443448
computedProp = {
444-
type: 'computed',
449+
type,
445450
key,
446451
value: instance[key]
447452
}
448453
} catch (e) {
449454
computedProp = {
450-
type: 'computed',
455+
type,
451456
key,
452457
value: '(error during evaluation)'
453458
}

src/devtools/components/StateInspector.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="data-wrapper">
33
<div v-for="type in Object.keys(state)" :class="['data-el', toDisplayType(type)]">
4-
<div class="data-type">{{ toDisplayType(type) }}</div>
4+
<div class="data-type">{{ toDisplayType(type, true) }}</div>
55
<div class="data-fields">
66
<template v-if="Array.isArray(state[type])">
77
<data-field
@@ -33,8 +33,14 @@ export default {
3333
DataField
3434
},
3535
methods: {
36-
toDisplayType (type) {
37-
return type === 'undefined' ? 'data' : type
36+
toDisplayType (type, full) {
37+
return type === 'undefined'
38+
? 'data'
39+
: full
40+
? (type === 'vuex' || type === 'firebase')
41+
? type + ' bindings'
42+
: type
43+
: type
3844
}
3945
}
4046
}

0 commit comments

Comments
 (0)