123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <template>
- <view
- v-if="inited"
- class="u-transition"
- ref="u-transition"
- @tap="clickHandler"
- :class="classes"
- :style="[mergeStyle]"
- @touchmove="noop"
- >
- <slot />
- </view>
- </template>
- <script>
- import { props } from './props';
- import { mpMixin } from '../../libs/mixin/mpMixin';
- import { mixin } from '../../libs/mixin/mixin';
- import { addStyle } from '../../libs/function/index';
- import transitionMixin from "./transitionMixin.js";
- export default {
- name: 'u-transition',
- data() {
- return {
- inited: false,
- viewStyle: {},
- status: '',
- transitionEnded: false,
- display: false,
- classes: '',
- }
- },
- emits: ['click', 'beforeEnter', 'enter', 'afterEnter', 'beforeLeave', 'leave', 'afterLeave'],
- computed: {
- mergeStyle() {
- const { viewStyle, customStyle } = this
- return {
-
- transitionDuration: `${this.duration}ms`,
-
- transitionTimingFunction: this.timingFunction,
-
-
- ...addStyle(customStyle),
- ...viewStyle
- }
- }
- },
-
- mixins: [mpMixin, mixin, transitionMixin, props],
- watch: {
- show: {
- handler(newVal) {
-
-
- newVal ? this.nvueEnter() : this.nvueLeave()
-
-
- newVal ? this.vueEnter() : this.vueLeave()
-
- },
-
- immediate: true
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import '../../libs/css/components.scss';
- @import './vue.ani-style.scss';
- .u-transition {}
- </style>
|