From 902a1b7c63bd9bffb17320f2b21a52ec3229aecc Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Fri, 4 Sep 2020 16:00:14 +0800 Subject: [PATCH] chore(Switch): useParentField --- src/notify/Notify.js | 2 +- src/switch/index.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/notify/Notify.js b/src/notify/Notify.js index 977b7fee2..7e8655800 100644 --- a/src/notify/Notify.js +++ b/src/notify/Notify.js @@ -33,7 +33,7 @@ export default createComponent({ duration={0.2} lockScroll={false} > - {slots.default?.() || props.message} + {slots.default ? slots.default() : props.message} ); }; diff --git a/src/switch/index.js b/src/switch/index.js index b83faf256..98fd53322 100644 --- a/src/switch/index.js +++ b/src/switch/index.js @@ -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();