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> <br>
<a-switch defaultChecked > <a-switch defaultChecked >
<a-icon type="check" slot="checkedChildren"/> <a-icon type="check" slot="checkedChildren"/>
<a-icon type="cross" slot="unCheckedChildren"/> <a-icon type="close" slot="unCheckedChildren"/>
</a-switch> </a-switch>
</div> </div>
</template> </template>

View File

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