Skip to content
Snippets Groups Projects
Commit cb383df5 authored by Tae Hoon's avatar Tae Hoon
Browse files

Fix bug to get wrapped component prop name list

parent 5c433745
Branches
No related tags found
No related merge requests found
import Vue from 'vue'
import filter from 'lodash/filter'
import isEmpty from 'lodash/isEmpty'
import { getComponentProps } from '../../services/component_utils/component_utils'
import './with_load_more.scss'
const withLoadMore = ({
......@@ -9,7 +10,7 @@ const withLoadMore = ({
childPropName = 'entries', // 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('withLoadMore', {
......
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', {
......
import isFunction from 'lodash/isFunction'
const getComponentOptions = (Component) => (isFunction(Component)) ? Component.options : Component
const getComponentProps = (Component) => getComponentOptions(Component).props
export {
getComponentOptions,
getComponentProps
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment