feat: update switch

pull/309/head
wangxueliang 2018-11-30 13:18:59 +08:00
parent 918cde803f
commit ac7cf55bcf
2 changed files with 9 additions and 1 deletions

View File

@ -17,7 +17,7 @@ With text and icon.
<br>
<a-switch defaultChecked >
<a-icon type="check" slot="checkedChildren"/>
<a-icon type="cross" slot="unCheckedChildren"/>
<a-icon type="close" slot="unCheckedChildren"/>
</a-switch>
</div>
</template>

View File

@ -3,6 +3,7 @@ import PropTypes from '../_util/vue-types'
import { getOptionProps, getComponentFromProp } from '../_util/props-util'
import VcSwitch from '../vc-switch'
import Wave from '../_util/wave'
import Icon from '../icon'
const Switch = {
name: 'ASwitch',
@ -38,10 +39,17 @@ const Switch = {
[`${prefixCls}-small`]: size === 'small',
[`${prefixCls}-loading`]: loading,
}
const loadingIcon = loading ? (
<Icon
type='loading'
class={`${prefixCls}-loading-icon`}
/>
) : null
const switchProps = {
props: {
...restProps,
prefixCls,
loadingIcon,
},
on: this.$listeners,
class: classes,