File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -431,23 +431,28 @@ function processState (instance) {
431
431
432
432
function processComputed ( instance ) {
433
433
const computed = [ ]
434
+ const defs = instance . $options . computed || { }
434
435
// use for...in here because if 'computed' is not defined
435
436
// on component, computed properties will be placed in prototype
436
437
// and Object.keys does not include
437
438
// 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'
439
444
// use try ... catch here because some computed properties may
440
445
// throw error during its evaluation
441
446
let computedProp = null
442
447
try {
443
448
computedProp = {
444
- type : 'computed' ,
449
+ type,
445
450
key,
446
451
value : instance [ key ]
447
452
}
448
453
} catch ( e ) {
449
454
computedProp = {
450
- type : 'computed' ,
455
+ type,
451
456
key,
452
457
value : '(error during evaluation)'
453
458
}
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div class =" data-wrapper" >
3
3
<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 >
5
5
<div class =" data-fields" >
6
6
<template v-if =" Array .isArray (state [type ])" >
7
7
<data-field
@@ -33,8 +33,14 @@ export default {
33
33
DataField
34
34
},
35
35
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
38
44
}
39
45
}
40
46
}
You can’t perform that action at this time.
0 commit comments