chore(Switch): useParentField

This commit is contained in:
chenjiahan 2020-09-04 16:00:14 +08:00
parent c1e9323f95
commit 902a1b7c63
2 changed files with 5 additions and 5 deletions

View File

@ -33,7 +33,7 @@ export default createComponent({
duration={0.2}
lockScroll={false}
>
{slots.default?.() || props.message}
{slots.default ? slots.default() : props.message}
</Popup>
);
};

View File

@ -2,8 +2,8 @@
import { createNamespace, addUnit } from '../utils';
import { switchProps } from './shared';
// Mixins
import { FieldMixin } from '../mixins/field';
// Composition
import { useParentField } from '../composition/use-parent-field';
// Components
import Loading from '../loading';
@ -11,8 +11,6 @@ import Loading from '../loading';
const [createComponent, bem] = createNamespace('switch');
export default createComponent({
mixins: [FieldMixin],
props: switchProps,
emits: ['change', 'update:modelValue'],
@ -35,6 +33,8 @@ export default createComponent({
}
};
useParentField(() => props.modelValue);
return () => {
const { size, loading, disabled, activeColor, inactiveColor } = props;
const checked = isChecked();