-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(transition): add transition comp and demo
- Loading branch information
Showing
5 changed files
with
125 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,31 @@ | ||
// import { | ||
// // createSimpleTransition, | ||
// createJavascriptTransition, | ||
// } from './src/CreateTransition'; | ||
import { createSimpleTransition, createJavascriptTransition } from './src/CreateTransition'; | ||
|
||
// import ExpandTransitionGenerator from './src/ExpandTransition'; | ||
import ExpandTransitionGenerator from './src/ExpandTransition'; | ||
|
||
export { default as CollapseTransition } from './src/CollapseTransition'; | ||
// export { default as CollapseTransition } from './src/CollapseTransition'; | ||
|
||
// export const FadeTransition = createSimpleTransition('fade-transition'); | ||
// export const ScaleTransition = createSimpleTransition('scale-transition'); | ||
// export const SlideYTransition = createSimpleTransition('slide-y-transition'); | ||
// export const ScrollYTransition = createSimpleTransition('scroll-y-transition'); | ||
// export const SlideYReverseTransition = createSimpleTransition('slide-y-reverse-transition'); | ||
// export const ScrollYReverseTransition = createSimpleTransition('scroll-y-reverse-transition'); | ||
// export const SlideXTransition = createSimpleTransition('slide-x-transition'); | ||
// export const ScrollXTransition = createSimpleTransition('scroll-x-transition'); | ||
// export const SlideXReverseTransition = createSimpleTransition('slide-x-reverse-transition'); | ||
// export const ScrollXReverseTransition = createSimpleTransition('scroll-x-reverse-transition'); | ||
// export const ScaleRotateTransition = createSimpleTransition('scale-rotate-transition'); | ||
export const FadeTransition = createSimpleTransition('fade-transition'); | ||
export const ScaleTransition = createSimpleTransition('scale-transition'); | ||
export const SlideYTransition = createSimpleTransition('slide-y-transition'); | ||
export const ScrollYTransition = createSimpleTransition('scroll-y-transition'); | ||
export const SlideYReverseTransition = createSimpleTransition('slide-y-reverse-transition'); | ||
export const ScrollYReverseTransition = createSimpleTransition('scroll-y-reverse-transition'); | ||
export const SlideXTransition = createSimpleTransition('slide-x-transition'); | ||
export const ScrollXTransition = createSimpleTransition('scroll-x-transition'); | ||
export const SlideXReverseTransition = createSimpleTransition('slide-x-reverse-transition'); | ||
export const ScrollXReverseTransition = createSimpleTransition('scroll-x-reverse-transition'); | ||
export const ScaleRotateTransition = createSimpleTransition('scale-rotate-transition'); | ||
|
||
// Javascript transitions | ||
// export const ExpandTransition = createJavascriptTransition( | ||
// 'expand-transition', | ||
// ExpandTransitionGenerator() | ||
// ); | ||
|
||
// export const ExpandXTransition = createJavascriptTransition( | ||
// 'expand-x-transition', | ||
// ExpandTransitionGenerator('', true) | ||
// ); | ||
export const ExpandXTransition = createJavascriptTransition( | ||
'expand-x-transition', | ||
ExpandTransitionGenerator('', true) | ||
); | ||
|
||
export { default as ExpandTransition } from './src/ExpandTransition.vue'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<template> | ||
<div class="p-4"> | ||
<div class="flex"> | ||
<Select | ||
:options="options" | ||
v-model:value="value" | ||
placeholder="选择动画" | ||
:style="{ width: '150px' }" | ||
/> | ||
<a-button type="primary" class="ml-4" @click="start"> start </a-button> | ||
</div> | ||
<component :is="`${value}Transition`"> | ||
<div class="box" v-show="show"></div> | ||
</component> | ||
</div> | ||
</template> | ||
<script lang="ts"> | ||
import { defineComponent, ref } from 'vue'; | ||
import { Select } from 'ant-design-vue'; | ||
import { | ||
FadeTransition, | ||
ScaleTransition, | ||
SlideYTransition, | ||
ScrollYTransition, | ||
SlideYReverseTransition, | ||
ScrollYReverseTransition, | ||
SlideXTransition, | ||
ScrollXTransition, | ||
SlideXReverseTransition, | ||
ScrollXReverseTransition, | ||
ScaleRotateTransition, | ||
ExpandXTransition, | ||
ExpandTransition, | ||
} from '/@/components/Transition/index'; | ||
const transitionList = [ | ||
'Fade', | ||
'Scale', | ||
'SlideY', | ||
'ScrollY', | ||
'SlideYReverse', | ||
'ScrollYReverse', | ||
'SlideX', | ||
'ScrollX', | ||
'SlideXReverse', | ||
'ScrollXReverse', | ||
'ScaleRotate', | ||
'ExpandX', | ||
'Expand', | ||
]; | ||
const options = transitionList.map((item) => ({ | ||
label: item, | ||
value: item, | ||
key: item, | ||
})); | ||
export default defineComponent({ | ||
components: { | ||
Select, | ||
FadeTransition, | ||
ScaleTransition, | ||
SlideYTransition, | ||
ScrollYTransition, | ||
SlideYReverseTransition, | ||
ScrollYReverseTransition, | ||
SlideXTransition, | ||
ScrollXTransition, | ||
SlideXReverseTransition, | ||
ScrollXReverseTransition, | ||
ScaleRotateTransition, | ||
ExpandXTransition, | ||
ExpandTransition, | ||
}, | ||
setup() { | ||
const value = ref('Fade'); | ||
const show = ref(true); | ||
function start() { | ||
show.value = false; | ||
setTimeout(() => { | ||
show.value = true; | ||
}, 300); | ||
} | ||
return { options, value, start, show }; | ||
}, | ||
}); | ||
</script> | ||
<style lang="less" scoped> | ||
.box { | ||
width: 150px; | ||
height: 150px; | ||
margin-top: 20px; | ||
background: pink; | ||
} | ||
</style> |