feat: migrate Checkbox/CheckboxGroup

This commit is contained in:
chenjiahan
2020-08-15 07:12:09 +08:00
parent 6f4c8f1e5b
commit cef8daf717
5 changed files with 32 additions and 26 deletions
+6 -6
View File
@@ -11,9 +11,9 @@ export const CheckboxMixin = ({ parent, bem, role }) => ({
props: {
name: null,
value: null,
disabled: Boolean,
iconSize: [Number, String],
modelValue: null,
checkedColor: String,
labelPosition: String,
labelDisabled: Boolean,
@@ -93,7 +93,9 @@ export const CheckboxMixin = ({ parent, bem, role }) => ({
])}
style={{ fontSize: addUnit(iconSize) }}
>
{this.slots('icon', { checked }) || (
{this.$slots.icon ? (
this.$slots.icon({ checked })
) : (
<Icon name="success" style={this.iconStyle} />
)}
</div>
@@ -101,9 +103,7 @@ export const CheckboxMixin = ({ parent, bem, role }) => ({
},
genLabel() {
const slot = this.slots();
if (slot) {
if (this.$slots.default) {
return (
<span
class={bem('label', [
@@ -111,7 +111,7 @@ export const CheckboxMixin = ({ parent, bem, role }) => ({
{ disabled: this.isDisabled },
])}
>
{slot}
{this.$slots.default()}
</span>
);
}