|
|
@ -1,17 +1,3 @@
|
|
|
|
<template>
|
|
|
|
|
|
|
|
<label :class="classes">
|
|
|
|
|
|
|
|
<span :class="checkboxClass">
|
|
|
|
|
|
|
|
<input :name="name" type="radio" :disabled="disabled"
|
|
|
|
|
|
|
|
:class="`${prefixCls}-input`" :checked="stateChecked"
|
|
|
|
|
|
|
|
@change="handleChange"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<span :class="`${prefixCls}-inner`" />
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<span v-if="hasDefaultSlot">
|
|
|
|
|
|
|
|
<slot></slot>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</label>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
import hasProp from '../_util/props-util'
|
|
|
|
import hasProp from '../_util/props-util'
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
@ -47,9 +33,6 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
computed: {
|
|
|
|
hasDefaultSlot () {
|
|
|
|
|
|
|
|
return !!this.$slots.default
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
classes () {
|
|
|
|
classes () {
|
|
|
|
const { prefixCls, disabled, stateChecked } = this
|
|
|
|
const { prefixCls, disabled, stateChecked } = this
|
|
|
|
return {
|
|
|
|
return {
|
|
|
@ -103,5 +86,22 @@ export default {
|
|
|
|
this.stateChecked = stateValue === this.value
|
|
|
|
this.stateChecked = stateValue === this.value
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
render () {
|
|
|
|
|
|
|
|
const { classes, checkboxClass, disabled, prefixCls, stateChecked, handleChange, name, $slots } = this
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
<label class={classes}>
|
|
|
|
|
|
|
|
<span class={checkboxClass}>
|
|
|
|
|
|
|
|
<input name={name} type='radio' disabled={disabled}
|
|
|
|
|
|
|
|
class={`${prefixCls}-input`} checked={stateChecked}
|
|
|
|
|
|
|
|
onChange={handleChange}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<span class={`${prefixCls}-inner`} />
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
{$slots.default ? <span>
|
|
|
|
|
|
|
|
{$slots.default}
|
|
|
|
|
|
|
|
</span> : null}
|
|
|
|
|
|
|
|
</label>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|