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
5 changed files with 10 additions and 9 deletions
+3 -4
View File
@@ -139,14 +139,14 @@ export default defineComponent({
});
const trackStyle = computed(() => {
const mainAxis = props.vertical ? 'height' : 'width';
const crossAxis = props.vertical ? 'width' : 'height';
const style: CSSProperties = {
transitionDuration: `${state.swiping ? 0 : props.duration}ms`,
transform: `translate${props.vertical ? 'Y' : 'X'}(${state.offset}px)`,
};
if (size.value) {
const mainAxis = props.vertical ? 'height' : 'width';
const crossAxis = props.vertical ? 'width' : 'height';
style[mainAxis] = `${trackSize.value}px`;
style[crossAxis] = props[crossAxis] ? `${props[crossAxis]}px` : '';
}
@@ -225,8 +225,7 @@ export default defineComponent({
if (state.active <= -1) {
move({ pace: count.value });
}
if (state.active >= count.value) {
} else if (state.active >= count.value) {
move({ pace: -count.value });
}
};