Fix bug to get wrapped component prop name list
This commit is contained in:
parent
5c43374588
commit
cb383df517
3 changed files with 14 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
import Vue from 'vue'
|
||||
import filter from 'lodash/filter'
|
||||
import isEmpty from 'lodash/isEmpty'
|
||||
import { getComponentProps } from '../../services/component_utils/component_utils'
|
||||
import './with_subscription.scss'
|
||||
|
||||
const withSubscription = ({
|
||||
|
@ -9,7 +10,7 @@ const withSubscription = ({
|
|||
childPropName = 'content', // name of the prop to be passed into the wrapped component
|
||||
additionalPropNames = [] // additional prop name list of the wrapper component
|
||||
}) => (WrappedComponent) => {
|
||||
const originalProps = WrappedComponent.props || []
|
||||
const originalProps = Object.keys(getComponentProps(WrappedComponent))
|
||||
const props = filter(originalProps, v => v !== childPropName).concat(additionalPropNames)
|
||||
|
||||
return Vue.component('withSubscription', {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue