提交 6338a63f 编写于 作者: I Ilkwon Sim 提交者: Guillaume Chau

feat: Add $attrs to StateInspector, closes #734 (#861)

This PR fixes #734 
Co-authored-by: NGuillaume Chau <alphadelta.fg@gmail.com>
上级 8eebefe9
......@@ -137,4 +137,13 @@ suite('components tab', () => {
expect(el.text()).to.contain('tester:<p id="testing"')
})
})
it('should display $attrs', () => {
cy.get('.instance .instance:nth-child(2) .arrow-wrapper').click()
cy.get('.instance .instance .instance:nth-child(1) .item-name').click()
cy.get('.right .data-wrapper').then(el => {
expect(el.text()).to.contain('$attrs')
expect(el.text()).to.contain('attr:"some-attr"')
})
})
})
......@@ -18,6 +18,7 @@ const computedPropMixin = {
export default {
name: 'other-with-mine',
inheritAttrs: false,
mixins: [computedPropMixin],
provide: {
foo: 'bar',
......
......@@ -8,7 +8,7 @@
<button class="add" @mouseup="add">Add 3</button>
<button class="remove" @mousedown="rm">Remove</button>
<input v-model="localMsg">
<other v-for="item in items" :key="item" :id="item"></other>
<other v-for="item in items" :key="item" :id="item" attr="some-attr"></other>
<div>
<button
class="inspect"
......
......@@ -539,7 +539,8 @@ function getInstanceState (instance) {
processRouteContext(instance),
processVuexGetters(instance),
processFirebaseBindings(instance),
processObservables(instance)
processObservables(instance),
processAttrs(instance)
)
}
......@@ -637,6 +638,16 @@ function processProps (instance) {
}
}
function processAttrs (instance) {
return Object.entries(instance.$attrs).map(([key, value]) => {
return {
type: '$attrs',
key,
value
}
})
}
/**
* Convert prop type constructor to string.
*
......
......@@ -65,7 +65,8 @@ const keyOrder = {
getters: 3,
mutation: 1,
'vuex bindings': 5,
$refs: 6
$refs: 6,
$attrs: 7
}
export default {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册