fix: collapse controller mode
							parent
							
								
									777d1d5dda
								
							
						
					
					
						commit
						ed3c4edf72
					
				|  | @ -1 +1 @@ | ||||||
| Subproject commit 46fbd8fd067c497a740594a1b8cc8e503fc94a8a | Subproject commit 4326327888f185e994eb7071d0b0b5edb1be2768 | ||||||
|  | @ -35,6 +35,10 @@ export default { | ||||||
|           }) |           }) | ||||||
|         : icon; |         : icon; | ||||||
|     }, |     }, | ||||||
|  |     handleChange(activeKey) { | ||||||
|  |       this.$emit('update:activeKey', activeKey); | ||||||
|  |       this.$emit('change', activeKey); | ||||||
|  |     }, | ||||||
|   }, |   }, | ||||||
|   render() { |   render() { | ||||||
|     const { prefixCls: customizePrefixCls, bordered, expandIconPosition } = this; |     const { prefixCls: customizePrefixCls, bordered, expandIconPosition } = this; | ||||||
|  | @ -52,6 +56,8 @@ export default { | ||||||
|       expandIcon: panelProps => this.renderExpandIcon(panelProps, prefixCls), |       expandIcon: panelProps => this.renderExpandIcon(panelProps, prefixCls), | ||||||
|       class: collapseClassName, |       class: collapseClassName, | ||||||
|       ...restAttrs, |       ...restAttrs, | ||||||
|  |       onChange: this.handleChange, | ||||||
|  |       'onUpdate:change': undefined, | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     return <VcCollapse {...rcCollapeProps}>{getSlot(this)}</VcCollapse>; |     return <VcCollapse {...rcCollapeProps}>{getSlot(this)}</VcCollapse>; | ||||||
|  |  | ||||||
|  | @ -117,9 +117,10 @@ export default { | ||||||
|       return newChildren; |       return newChildren; | ||||||
|     }, |     }, | ||||||
|     setActiveKey(activeKey) { |     setActiveKey(activeKey) { | ||||||
|  |       if (!hasProp(this, 'activeKey')) { | ||||||
|         this.setState({ stateActiveKey: activeKey }); |         this.setState({ stateActiveKey: activeKey }); | ||||||
|  |       } | ||||||
|       this.__emit('change', this.accordion ? activeKey[0] : activeKey); |       this.__emit('change', this.accordion ? activeKey[0] : activeKey); | ||||||
|       this.__emit('update:activeKey', this.accordion ? activeKey[0] : activeKey); |  | ||||||
|     }, |     }, | ||||||
|   }, |   }, | ||||||
|   render() { |   render() { | ||||||
|  |  | ||||||
|  | @ -18,6 +18,8 @@ const collapseProps = () => ({ | ||||||
|   expandIcon: PropTypes.func, |   expandIcon: PropTypes.func, | ||||||
|   openAnimation: PropTypes.object, |   openAnimation: PropTypes.object, | ||||||
|   expandIconPosition: PropTypes.oneOf(['left', 'right']), |   expandIconPosition: PropTypes.oneOf(['left', 'right']), | ||||||
|  |   'onUpdate:change': PropTypes.func, | ||||||
|  |   onChange: PropTypes.func, | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| const panelProps = () => ({ | const panelProps = () => ({ | ||||||
|  |  | ||||||
|  | @ -4,7 +4,7 @@ | ||||||
|   </div> |   </div> | ||||||
| </template> | </template> | ||||||
| <script> | <script> | ||||||
| import demo from '../antdv-demo/docs/checkbox/demo/basic'; | import demo from '../antdv-demo/docs/collapse/demo/index'; | ||||||
| 
 | 
 | ||||||
| export default { | export default { | ||||||
|   components: { |   components: { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 tanjinzhou
						tanjinzhou