Skip to content

Commit aa7672c

Browse files
authored
Update componentdoc.vue
1 parent 7889590 commit aa7672c

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

docs/components/componentdoc.vue

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,26 @@ export default {
139139
}
140140
},
141141
computed: {
142-
componentOptions() {
143-
const component = Vue.options.components[this.component]
144-
return component && component.options ? component.options : {}
145-
},
146-
propsFields() {
142+
componentProps() {
147143
const component = Vue.options.components[this.component]
144+
if (!component) {
145+
return {}
146+
}
147+
148148
let props = {}
149-
if (component) {
149+
if (!component.options && typeof component === 'function') {
150+
// Async component that hans't been resolved yet.
151+
component(opts => {
152+
props = opts.props ? { ...opts.props } : {}
153+
})
154+
} else {
155+
// Regular component
150156
props = component.options.props || {}
151157
}
158+
},
159+
propsFields() {
160+
const component = Vue.options.components[this.component]
161+
const props = this.componentProps
152162
153163
const hasRequired = Object.keys(props).some(p => props[p].required)
154164
@@ -186,19 +196,10 @@ export default {
186196
propsItems() {
187197
const component = Vue.options.components[this.component]
188198
if (!component) {
189-
return {}
199+
return []
190200
}
191201
192-
let props = {}
193-
if (!component.options && typeof component === 'function') {
194-
// Async component that hans't been resolved yet.
195-
component(opts => {
196-
props = opts.props ? { ...opts.props } : {}
197-
})
198-
} else {
199-
// Regular component
200-
props = component.options.props || {}
201-
}
202+
const props = this.componentProps : {}
202203
203204
return Object.keys(props).map(prop => {
204205
const p = props[prop]

0 commit comments

Comments
 (0)