feat: update collapse

pull/309/head
tangjinzhou 2018-12-15 21:51:17 +08:00
parent e1cd139e8b
commit c36f435769
2 changed files with 10 additions and 2 deletions

View File

@ -1,7 +1,7 @@
import animation from '../_util/openAnimation' import animation from '../_util/openAnimation'
import { getOptionProps, initDefaultProps } from '../_util/props-util' import { getOptionProps, initDefaultProps } from '../_util/props-util'
import VcCollapse, { collapseProps } from '../vc-collapse' import VcCollapse, { collapseProps } from '../vc-collapse'
import Icon from '../icon'
export default { export default {
name: 'ACollapse', name: 'ACollapse',
model: { model: {
@ -13,6 +13,13 @@ export default {
bordered: true, bordered: true,
openAnimation: animation, openAnimation: animation,
}), }),
methods: {
renderExpandIcon () {
return (
<Icon type='right' class='arrow' />
)
},
},
render () { render () {
const { prefixCls, bordered, $listeners } = this const { prefixCls, bordered, $listeners } = this
const collapseClassName = { const collapseClassName = {
@ -21,6 +28,7 @@ export default {
const rcCollapeProps = { const rcCollapeProps = {
props: { props: {
...getOptionProps(this), ...getOptionProps(this),
expandIcon: this.renderExpandIcon,
}, },
class: collapseClassName, class: collapseClassName,
on: $listeners, on: $listeners,

View File

@ -57,7 +57,7 @@ export default {
} }
let icon = null let icon = null
if (showArrow && typeof expandIcon === 'function') { if (showArrow && typeof expandIcon === 'function') {
icon = cloneElement(expandIcon, { ...this.$props }) icon = cloneElement(expandIcon(this.$props))
} }
return ( return (
<div class={itemCls} role='tablist'> <div class={itemCls} role='tablist'>