From 3c415c42d0cc67fa119cd55aa913f923cd0f0f13 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Fri, 4 Sep 2020 15:33:35 +0800 Subject: [PATCH] chore: adjust code --- src/action-sheet/index.js | 2 +- src/contact-card/index.js | 14 +++++++------- src/list/index.js | 2 +- src/loading/index.js | 10 +++++----- src/slider/index.js | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/action-sheet/index.js b/src/action-sheet/index.js index b859dfb3f..6073f467e 100644 --- a/src/action-sheet/index.js +++ b/src/action-sheet/index.js @@ -86,7 +86,7 @@ export default createComponent({ const onClick = () => { emit('select', item, index); if (props.closeOnClickAction) { - emit('update:show', false); + onUpdateShow(false); } }; diff --git a/src/contact-card/index.js b/src/contact-card/index.js index 73e77add5..43765181a 100644 --- a/src/contact-card/index.js +++ b/src/contact-card/index.js @@ -21,13 +21,13 @@ export default createComponent({ emits: ['click'], setup(props, { emit }) { - function onClick(event) { + const onClick = (event) => { if (props.editable) { emit('click', event); } - } + }; - function Content() { + const renderContent = () => { if (props.type === 'add') { return props.addText || t('addText'); } @@ -36,19 +36,19 @@ export default createComponent({
{`${t('name')}:${props.name}`}
,
{`${t('tel')}:${props.tel}`}
, ]; - } + }; return () => ( - {Content()} + {renderContent()} ); }, diff --git a/src/list/index.js b/src/list/index.js index ccfdc896f..bad897dab 100644 --- a/src/list/index.js +++ b/src/list/index.js @@ -107,7 +107,7 @@ export default createComponent({ const text = slots.error ? slots.error() : props.errorText; if (text) { return ( -
+
{text}
); diff --git a/src/loading/index.js b/src/loading/index.js index 31d2bf4b3..1ec170bf9 100644 --- a/src/loading/index.js +++ b/src/loading/index.js @@ -27,6 +27,11 @@ export default createComponent({ }, setup(props, { slots }) { + const spinnerStyle = computed(() => ({ + color: props.color, + ...getSizeStyle(props.size), + })); + const renderText = () => { if (slots.default) { return ( @@ -42,11 +47,6 @@ export default createComponent({ } }; - const spinnerStyle = computed(() => ({ - color: props.color, - ...getSizeStyle(props.size), - })); - return () => { const { type, vertical } = props; return ( diff --git a/src/slider/index.js b/src/slider/index.js index 3aa93f0be..0c9a27888 100644 --- a/src/slider/index.js +++ b/src/slider/index.js @@ -151,12 +151,12 @@ export default createComponent({ const renderButton = () => (