chore: adjust some code (#8446)

This commit is contained in:
neverland 2021-04-02 10:19:33 +08:00 committed by GitHub
parent 65185069bf
commit 74e19f55d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 9 deletions

View File

@ -381,15 +381,15 @@ export default defineComponent({
onBlur={onDetailBlur} onBlur={onDetailBlur}
onFocus={() => onFocus('addressDetail')} onFocus={() => onFocus('addressDetail')}
onInput={onChangeDetail} onInput={onChangeDetail}
onSelect-search={(event: Event) => emit('select-search', event)} onSelectSearch={(event: Event) => emit('select-search', event)}
/> />
{props.showPostal && ( {props.showPostal && (
<Field <Field
v-show={!hideBottomFields.value} v-show={!hideBottomFields.value}
v-model={data.postalCode} v-model={data.postalCode}
type="tel" type="tel"
maxlength="6"
label={t('postal')} label={t('postal')}
maxlength="6"
placeholder={t('postal')} placeholder={t('postal')}
errorMessage={errorInfo.postalCode} errorMessage={errorInfo.postalCode}
onFocus={() => onFocus('postalCode')} onFocus={() => onFocus('postalCode')}
@ -402,9 +402,9 @@ export default defineComponent({
<Button <Button
block block
round round
loading={props.isSaving}
type="danger" type="danger"
text={props.saveButtonText || t('save')} text={props.saveButtonText || t('save')}
loading={props.isSaving}
onClick={onSave} onClick={onSave}
/> />
{props.showDelete && ( {props.showDelete && (

View File

@ -139,14 +139,14 @@ export default defineComponent({
}); });
const trackStyle = computed(() => { const trackStyle = computed(() => {
const mainAxis = props.vertical ? 'height' : 'width';
const crossAxis = props.vertical ? 'width' : 'height';
const style: CSSProperties = { const style: CSSProperties = {
transitionDuration: `${state.swiping ? 0 : props.duration}ms`, transitionDuration: `${state.swiping ? 0 : props.duration}ms`,
transform: `translate${props.vertical ? 'Y' : 'X'}(${state.offset}px)`, transform: `translate${props.vertical ? 'Y' : 'X'}(${state.offset}px)`,
}; };
if (size.value) { if (size.value) {
const mainAxis = props.vertical ? 'height' : 'width';
const crossAxis = props.vertical ? 'width' : 'height';
style[mainAxis] = `${trackSize.value}px`; style[mainAxis] = `${trackSize.value}px`;
style[crossAxis] = props[crossAxis] ? `${props[crossAxis]}px` : ''; style[crossAxis] = props[crossAxis] ? `${props[crossAxis]}px` : '';
} }
@ -225,8 +225,7 @@ export default defineComponent({
if (state.active <= -1) { if (state.active <= -1) {
move({ pace: count.value }); move({ pace: count.value });
} } else if (state.active >= count.value) {
if (state.active >= count.value) {
move({ pace: -count.value }); move({ pace: -count.value });
} }
}; };

View File

@ -1,3 +1,4 @@
import { defineComponent } from 'vue';
import { mount, later } from '../../../test'; import { mount, later } from '../../../test';
import { Tab } from '..'; import { Tab } from '..';
import { Tabs } from '../../tabs'; import { Tabs } from '../../tabs';
@ -64,11 +65,11 @@ test('should render correctly after inserting a tab with name', async () => {
}); });
test('should render Tab inside a component correctly', async () => { test('should render Tab inside a component correctly', async () => {
const MyTab = { const MyTab = defineComponent({
render() { render() {
return <Tab title="2">2</Tab>; return <Tab title="2">2</Tab>;
}, },
}; });
const wrapper = mount({ const wrapper = mount({
render() { render() {

View File

@ -36,5 +36,6 @@ declare module 'vue' {
onTouchmove?: EventHandler; onTouchmove?: EventHandler;
onTouchstart?: EventHandler; onTouchstart?: EventHandler;
onTouchcancel?: EventHandler; onTouchcancel?: EventHandler;
onSelectSearch?: EventHandler;
} }
} }