diff --git a/antdv-demo b/antdv-demo index f7a4bb76d..52006fa6a 160000 --- a/antdv-demo +++ b/antdv-demo @@ -1 +1 @@ -Subproject commit f7a4bb76d93075062da04b34afb264aefee1c351 +Subproject commit 52006fa6ae47595a2af099ab226e3c79861d3f84 diff --git a/components/_util/store/connect.jsx b/components/_util/store/connect.jsx index ca970e4dc..792a0a279 100644 --- a/components/_util/store/connect.jsx +++ b/components/_util/store/connect.jsx @@ -9,7 +9,7 @@ function getDisplayName(WrappedComponent) { } const defaultMapStateToProps = () => ({}); -export default function connect(mapStateToProps, injectExtraPropsKey) { +export default function connect(mapStateToProps) { const shouldSubscribe = !!mapStateToProps; const finalMapStateToProps = mapStateToProps || defaultMapStateToProps; return function wrapWithConnect(WrappedComponent) { @@ -25,43 +25,18 @@ export default function connect(mapStateToProps, injectExtraPropsKey) { props, inject: { storeContext: { default: () => ({}) }, - ...(injectExtraPropsKey - ? { - injectExtraContext: { - from: injectExtraPropsKey, - default: () => ({}), - }, - } - : {}), - }, - computed: { - injectExtraProps() { - return this.injectExtraContext ? this.injectExtraContext.$attrs : {}; - }, - injectExtraListeners() { - return this.injectExtraContext ? this.injectExtraContext.$listeners : {}; - }, }, data() { this.store = this.storeContext.store; - this.preProps = { - ...omit(getOptionProps(this), ['__propsSymbol__']), - ...this.injectExtraProps, - }; + this.preProps = omit(getOptionProps(this), ['__propsSymbol__']); return { - subscribed: finalMapStateToProps(this.store.getState(), { - ...this.$props, - ...this.injectExtraProps, - }), + subscribed: finalMapStateToProps(this.store.getState(), this.$props), }; }, watch: { __propsSymbol__() { if (mapStateToProps && mapStateToProps.length === 2) { - this.subscribed = finalMapStateToProps(this.store.getState(), { - ...this.$props, - ...this.injectExtraProps, - }); + this.subscribed = finalMapStateToProps(this.store.getState(), this.$props); } }, }, @@ -77,10 +52,7 @@ export default function connect(mapStateToProps, injectExtraPropsKey) { if (!this.unsubscribe) { return; } - const props = { - ...omit(getOptionProps(this), ['__propsSymbol__']), - ...this.injectExtraProps, - }; + const props = omit(getOptionProps(this), ['__propsSymbol__']); const nextSubscribed = finalMapStateToProps(this.store.getState(), props); if ( !shallowEqual(this.preProps, props) || @@ -109,7 +81,7 @@ export default function connect(mapStateToProps, injectExtraPropsKey) { }, render() { const { $slots = {}, $scopedSlots, subscribed, store } = this; - const props = { ...getOptionProps(this), ...this.injectExtraProps }; + const props = getOptionProps(this); this.preProps = { ...omit(props, ['__propsSymbol__']) }; const wrapProps = { props: { @@ -117,7 +89,7 @@ export default function connect(mapStateToProps, injectExtraPropsKey) { ...subscribed, store, }, - on: { ...getListeners(this), ...this.injectExtraListeners }, + on: getListeners(this), scopedSlots: $scopedSlots, }; return ( diff --git a/components/layout/__tests__/__snapshots__/demo.test.js.snap b/components/layout/__tests__/__snapshots__/demo.test.js.snap index cb081120a..576bca6d8 100644 --- a/components/layout/__tests__/__snapshots__/demo.test.js.snap +++ b/components/layout/__tests__/__snapshots__/demo.test.js.snap @@ -322,7 +322,7 @@ exports[`renders ./antdv-demo/docs/layout/demo/top-side.md correctly 1`] = `