From 16213c0f85aa3ac8317797bf4a05fd12940e16d3 Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期三, 05 三月 2025 17:29:42 +0800
Subject: [PATCH] -

---
 src/uni_modules/uview-plus/components/u-transition/transition.js |  175 +++++-----------------------------------------------------
 1 files changed, 15 insertions(+), 160 deletions(-)

diff --git a/src/uni_modules/uview-plus/components/u-transition/transition.js b/src/uni_modules/uview-plus/components/u-transition/transition.js
index b1ae487..0fad118 100644
--- a/src/uni_modules/uview-plus/components/u-transition/transition.js
+++ b/src/uni_modules/uview-plus/components/u-transition/transition.js
@@ -1,163 +1,18 @@
-// 瀹氫箟涓�涓竴瀹氭椂闂村悗鑷姩鎴愬姛鐨刾romise锛岃璋冪敤nextTick鏂规硶澶勶紝杩涘叆涓嬩竴涓猼hen鏂规硶
-const waitTick = () => new Promise(resolve => setTimeout(resolve, 1000 / 50))
-// nvue鍔ㄧ敾妯″潡瀹炵幇缁嗚妭鎶界鍦ㄥ閮ㄦ枃浠�
-// #ifdef APP-NVUE
-import animationMap from './nvue-ani-map.js'
-// #endif
-
-// #ifndef APP-NVUE
-// 瀹氫箟绫诲悕锛岄�氳繃缁欏厓绱犲姩鎬佸垏鎹㈢被鍚嶏紝璧嬩簣鍏冪礌涓�瀹氱殑css鍔ㄧ敾鏍峰紡
-const getClassNames = (name) => ({
-    enter: `u-${name}-enter u-${name}-enter-active`,
-    'enter-to': `u-${name}-enter-to u-${name}-enter-active`,
-    leave: `u-${name}-leave u-${name}-leave-active`,
-    'leave-to': `u-${name}-leave-to u-${name}-leave-active`
-})
-// #endif
-
-// #ifdef APP-NVUE
-// 寮曞叆nvue(weex)鐨刟nimation鍔ㄧ敾妯″潡锛屾枃妗h锛�
-// https://weex.apache.org/zh/docs/modules/animation.html#transition
-const animation = uni.requireNativePlugin('animation')
-const getStyle = (name) => animationMap[name]
-// #endif
-
-import { nextTick } from 'vue'
-import { sleep } from '../../libs/function/index';
+/*
+ * @Author       : LQ
+ * @Description  :
+ * @version      : 1.0
+ * @Date         : 2021-08-20 16:44:21
+ * @LastAuthor   : LQ
+ * @lastTime     : 2021-08-20 16:59:00
+ * @FilePath     : /u-view2.0/uview-ui/libs/config/props/transition.js
+ */
 export default {
-    methods: {
-        // 缁勪欢琚偣鍑诲彂鍑轰簨浠�
-        clickHandler() {
-            this.$emit('click')
-        },
-        // #ifndef APP-NVUE
-        // vue鐗堟湰鐨勭粍浠惰繘鍦哄鐞�
-        async vueEnter() {
-            // 鍔ㄧ敾杩涘叆鏃剁殑绫诲悕
-            const classNames = getClassNames(this.mode)
-            // 瀹氫箟鐘舵�佸拰鍙戝嚭鍔ㄧ敾杩涘叆鍓嶄簨浠�
-            this.status = 'enter'
-            this.$emit('beforeEnter')
-            this.inited = true
-            this.display = true
-            this.classes = classNames.enter
-			await nextTick();
-			{
-                // https://github.com/umicro/uView2.0/issues/545
-				await sleep(20)
-                // 鏍囪瘑鍔ㄧ敾灏氭湭缁撴潫
-                this.$emit('enter')
-                this.transitionEnded = false
-				// 缁勪欢鍔ㄧ敾杩涘叆鍚庤Е鍙戠殑浜嬩欢
-                this.$emit('afterEnter')
-                // 璧嬩簣缁勪欢enter-to绫诲悕
-                this.classes = classNames['enter-to']
-            }
-        },
-        // 鍔ㄧ敾绂诲満澶勭悊
-        async vueLeave() {
-            // 濡傛灉涓嶆槸灞曠ず鐘舵�侊紝鏃犻渶鎵ц閫昏緫
-            if (!this.display) return
-            const classNames = getClassNames(this.mode)
-            // 鏍囪绂诲紑鐘舵�佸拰鍙戝嚭浜嬩欢
-            this.status = 'leave'
-            this.$emit('beforeLeave')
-            // 鑾峰緱绫诲悕
-            this.classes = classNames.leave
-
-            await nextTick();
-			{
-               // 鍔ㄧ敾姝e湪绂诲満鐨勭姸鎬�
-               this.transitionEnded = false
-               this.$emit('leave')
-                // 缁勪欢鎵ц鍔ㄧ敾锛屽埌浜嗘墽琛岀殑鎵ц鏃堕棿鍚庯紝鎵ц涓�浜涢澶栧鐞�
-                setTimeout(this.onTransitionEnd, this.duration)
-                this.classes = classNames['leave-to']
-            }
-        },
-        // #endif
-        // #ifdef APP-NVUE
-        // nvue鐗堟湰鍔ㄧ敾杩涘満
-        async nvueEnter() {
-            // 鑾峰緱鏍峰紡鐨勫悕绉�
-            const currentStyle = getStyle(this.mode)
-            // 缁勪欢鍔ㄧ敾鐘舵�佸拰鍙戝嚭浜嬩欢
-            this.status = 'enter'
-            this.$emit('beforeEnter')
-            // 灞曠ず鐢熸垚缁勪欢鍏冪礌
-            this.inited = true
-            this.display = true
-            // 鍦╪vue瀹夊崜涓婏紝鐢变簬娓叉煋閫熷害鎱紝鍦ㄥ脊绐楋紝閿洏锛屾棩鍘嗙瓑缁勪欢涓紝娓叉煋鍏朵腑鐨勫唴瀹归渶瑕佹椂闂�
-            // 瀵艰嚧鍑虹幇寮圭獥鍗¢】锛岃繖閲岃鍏朵竴寮�濮嬩负閫忔槑鐘舵�侊紝绛変竴瀹氭椂闂存覆鏌撳畬鎴愬悗锛屽啀璁╁叾闅愯棌璧锋潵锛屽啀璁╁叾鎸夋甯搁�昏緫鍑虹幇
-            this.viewStyle = {
-                opacity: 0
-            }
-            // 绛夊緟寮圭獥鍐呭娓叉煋瀹屾垚
-            await nextTick();
-			{
-                // 鍚堝苟鏍峰紡
-                this.viewStyle = currentStyle.enter
-                Promise.resolve()
-                    .then(waitTick)
-                    .then(() => {
-                        // 缁勪欢寮�濮嬭繘鍏ュ墠鐨勪簨浠�
-                        this.$emit('enter')
-                        // nvue鐨則ransition鍔ㄧ敾妯″潡闇�瑕侀�氳繃ref璋冪敤缁勪欢锛屾敞鎰忔澶勭殑ref涓嶅悓浜巚ue鐨則his.$refs['u-transition']鐢ㄦ硶
-                        animation.transition(this.$refs['u-transition'].ref, {
-                            styles: currentStyle['enter-to'],
-                            duration: this.duration,
-                            timingFunction: this.timingFunction,
-                            needLayout: false,
-                            delay: 0
-                        }, () => {
-                            // 鍔ㄧ敾鎵ц瀹屾瘯锛屽彂鍑轰簨浠�
-                            this.$emit('afterEnter')
-                        })
-                    })
-                    .catch(() => {})
-            }
-        },
-        nvueLeave() {
-            if (!this.display) {
-                return
-            }
-            const currentStyle = getStyle(this.mode)
-            // 瀹氫箟鐘舵�佸拰浜嬩欢
-            this.status = 'leave'
-            this.$emit('beforeLeave')
-            // 鍚堝苟鏍峰紡
-            this.viewStyle = currentStyle.leave
-            // 鏀惧埌promise涓鐞嗘墽琛岃繃绋�
-            Promise.resolve()
-                .then(waitTick) // 绛夊緟鍑犲崄ms
-                .then(() => {
-                    this.transitionEnded = false
-                    // 鍔ㄧ敾姝e湪绂诲満鐨勭姸鎬�
-                    this.$emit('leave')
-                    animation.transition(this.$refs['u-transition'].ref, {
-                        styles: currentStyle['leave-to'],
-                        duration: this.duration,
-                        timingFunction: this.timingFunction,
-                        needLayout: false,
-                        delay: 0
-                    }, () => {
-                        this.onTransitionEnd()
-                    })
-                })
-                .catch(() => {})
-        },
-        // #endif
-        // 瀹屾垚杩囨浮鍚庤Е鍙�
-        onTransitionEnd() {
-            // 濡傛灉宸茬粡鏄粨鏉熺殑鐘舵�侊紝鏃犻渶鍐嶅鐞�
-            if (this.transitionEnded) return
-            this.transitionEnded = true
-            // 鍙戝嚭缁勪欢鍔ㄧ敾鎵ц鍚庣殑浜嬩欢
-            this.$emit(this.status === 'leave' ? 'afterLeave' : 'afterEnter')
-            if (!this.show && this.display) {
-                this.display = false
-                this.inited = false
-            }
-        }
+    // transition鍔ㄧ敾缁勪欢鐨刾rops
+    transition: {
+        show: false,
+        mode: 'fade',
+        duration: '300',
+        timingFunction: 'ease-out'
     }
 }

--
Gitblit v1.9.1