From 6ad289482317325c7a1b67425cd05d5c688f5876 Mon Sep 17 00:00:00 2001 From: "1054425342@qq.com" <1054425342@qq.com> Date: Sat, 2 Aug 2025 14:23:42 +0800 Subject: [PATCH] feat pig --- pages.json | 927 ++++++++------- pig/chapter1/chapter1.vue | 330 ++++++ pig/chapter2/chapter2.vue | 369 ++++++ pig/chapter3/art.vue | 83 ++ pig/chapter3/brave.vue | 84 ++ pig/chapter3/chapter3.vue | 426 +++++++ pig/chapter3/humble.vue | 83 ++ pig/chapter3/sacred.vue | 84 ++ pig/chapter3/smart.vue | 83 ++ pig/chapter3/stupid.vue | 83 ++ pig/chapter4/chapter4.vue | 644 +++++++++++ pig/chapter4/first.vue | 109 ++ pig/chapter4/fourth.vue | 109 ++ pig/chapter4/secBuy.vue | 155 +++ pig/chapter4/second.vue | 109 ++ pig/chapter4/third.vue | 109 ++ pig/home/home.vue | 1005 +++++++++++++++++ .../uni-transition/createAnimation.js | 24 +- .../uni-transition/uni-transition.vue | 71 +- 19 files changed, 4472 insertions(+), 415 deletions(-) create mode 100644 pig/chapter1/chapter1.vue create mode 100644 pig/chapter2/chapter2.vue create mode 100644 pig/chapter3/art.vue create mode 100644 pig/chapter3/brave.vue create mode 100644 pig/chapter3/chapter3.vue create mode 100644 pig/chapter3/humble.vue create mode 100644 pig/chapter3/sacred.vue create mode 100644 pig/chapter3/smart.vue create mode 100644 pig/chapter3/stupid.vue create mode 100644 pig/chapter4/chapter4.vue create mode 100644 pig/chapter4/first.vue create mode 100644 pig/chapter4/fourth.vue create mode 100644 pig/chapter4/secBuy.vue create mode 100644 pig/chapter4/second.vue create mode 100644 pig/chapter4/third.vue create mode 100644 pig/home/home.vue diff --git a/pages.json b/pages.json index 2e70951..df17124 100644 --- a/pages.json +++ b/pages.json @@ -1,412 +1,549 @@ { - "pages": [ + "pages": [ + { + "path": "pages/stratIndex", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/index/index", + "style": { + "navigationStyle": "custom" + // "navigationBarTitleText": "CGC-ICH" + } + }, + { + "path": "pages/index/readingBody", + "style": { + "navigationStyle": "custom" + // "navigationBarTitleText": "阅读体" + } + }, + { + "path": "pages/index/sensoryStore", + "style": { + "navigationStyle": "custom" + // "navigationBarTitleText": "有感商店" + } + }, + { + "path": "pages/index/intelligentAgent", + "style": { + "navigationStyle": "custom" + // "navigationBarTitleText": "智能体" + } + }, + { + "path": "pages/index/iSoul", + "style": { + "navigationStyle": "custom" + // "navigationBarTitleText": "iSoul" + } + }, + { + "path": "pages/login/login", + "style": { + "navigationBarTitleText": "登录", + "navigationStyle": "custom" + } + } + ], + "subPackages": [ + { + "root": "subPackages", + "pages": [ + { + "path": "order/trades", + "style": { + "navigationBarTitleText": "全部订单" + } + }, + { + "path": "order/detail", + "style": { + "navigationBarTitleText": "订单详情", + "navigationStyle": "custom" + } + }, + { + "path": "techan/index", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "techan/detail", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "techan/order", + "style": { + "navigationBarTitleText": "确认订单" + } + }, + { + "path": "webPage/webPage", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "video/video", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "readingBody/index", + "style": { + "navigationBarTitleText": "阅读体", + "navigationStyle": "custom" + } + }, + { + "path": "haveFeeling/shopDetail", + "style": { + "navigationBarTitleText": "有感商店详情页", + "navigationStyle": "custom" + } + }, + { + "path": "haveFeeling/detailXiang", + "style": { + "navigationBarTitleText": "有感商店" + } + }, + { + "path": "letter/detail", + "style": { + "navigationBarTitleText": "文章详情" + } + }, + { + "path": "user/privacy", + "style": { + "navigationBarTitleText": "详情" + } + }, + { + "path": "user/privacyInfo", + "style": { + "navigationBarTitleText": "详情" + } + }, + { + "path": "user/travelerList", + "style": { + "navigationBarTitleText": "收货地址" + } + }, + { + "path": "user/myAddressAdd", + "style": { + "navigationBarTitleText": "收货地址" + } + }, + { + "path": "user/gwc", + "style": { + "navigationBarTitleText": "购物车" + } + }, + { + "path": "order/gwcOrder", + "style": { + "navigationBarTitleText": "下单" + } + }, + { + "path": "user/profile", + "style": { + "navigationBarTitleText": "个人信息" + } + }, + { + "path": "user/changeNickname", + "style": { + "navigationBarTitleText": "修改昵称" + } + }, + { + "path": "search/search", + "style": { + "navigationBarTitleText": "搜索" + } + } + ] + }, + { + "root": "xxdf", + "pages": [ + { + "path": "home/home", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "chapter1/cover1", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "chapter1/detail1", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "chapter1/detail2", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "chapter1/detail3", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, { - "path": "pages/stratIndex", - "style": { - "navigationStyle": "custom" - } + "path": "chapter1/detail4", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } }, { - "path": "pages/index/index", - "style": { - "navigationStyle": "custom" - // "navigationBarTitleText": "CGC-ICH" - } + "path": "chapter1/detail5", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } }, { - "path": "pages/index/readingBody", - "style": { - "navigationStyle": "custom" - // "navigationBarTitleText": "阅读体" - } + "path": "chapter2/cover", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } }, { - "path": "pages/index/sensoryStore", - "style": { - "navigationStyle": "custom" - // "navigationBarTitleText": "有感商店" - } + "path": "chapter3/cover", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } }, { - "path": "pages/index/intelligentAgent", - "style": { - "navigationStyle": "custom" - // "navigationBarTitleText": "智能体" - } + "path": "chapter3/randomImage", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } }, { - "path": "pages/index/iSoul", - "style": { - "navigationStyle": "custom" - // "navigationBarTitleText": "iSoul" - } + "path": "chapter4/cover", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom", + "enableShareAppMessage": true, + "enableShareTimeline": true + } + } + ] + }, + { + "root": "taozi", + "pages": [ + { + "path": "home/home", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "chapter1/chapter1", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "chapter2/chapter2", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } }, { - "path": "pages/login/login", - "style": { - "navigationBarTitleText": "登录", - "navigationStyle": "custom" - } + "path": "chapter3/chapter3", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "chapter4/chapter4", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } } - ], - "subPackages": [ - { - "root": "subPackages", - "pages": [ - { - "path": "order/trades", - "style": { - "navigationBarTitleText": "全部订单" - } - }, - { - "path": "order/detail", - "style": { - "navigationBarTitleText": "订单详情", - "navigationStyle": "custom" - } - }, - { - "path": "techan/index", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "techan/detail", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "techan/order", - "style": { - "navigationBarTitleText": "确认订单" - } - }, - { - "path": "webPage/webPage", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "video/video", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "readingBody/index", - "style": { - "navigationBarTitleText": "阅读体", - "navigationStyle": "custom" - } - }, - { - "path": "haveFeeling/shopDetail", - "style": { - "navigationBarTitleText": "有感商店详情页", - "navigationStyle": "custom" - } - }, - { - "path": "haveFeeling/detailXiang", - "style": { - "navigationBarTitleText": "有感商店" - } - }, - { - "path": "letter/detail", - "style": { - "navigationBarTitleText": "文章详情" - } - }, - { - "path": "user/privacy", - "style": { - "navigationBarTitleText": "详情" - } - }, - { - "path": "user/privacyInfo", - "style": { - "navigationBarTitleText": "详情" - } - }, - { - "path": "user/travelerList", - "style": { - "navigationBarTitleText": "收货地址" - } - }, - { - "path": "user/myAddressAdd", - "style": { - "navigationBarTitleText": "收货地址" - } - }, - { - "path": "user/gwc", - "style": { - "navigationBarTitleText": "购物车" - } - }, - { - "path" : "order/gwcOrder", - "style" : { - "navigationBarTitleText" : "下单" - } - }, - { - "path": "user/profile", - "style": { - "navigationBarTitleText": "个人信息" - } - }, - { - "path": "user/changeNickname", - "style": { - "navigationBarTitleText": "修改昵称" - } - }, - { - "path": "search/search", - "style": { - "navigationBarTitleText": "搜索" - } - } - ] - }, - { - "root": "xxdf", - "pages": [ - { - "path": "home/home", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter1/cover1", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter1/detail1", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter1/detail2", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter1/detail3", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter1/detail4", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter1/detail5", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter2/cover", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter3/cover", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter3/randomImage", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter4/cover", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom", - "enableShareAppMessage": true, - "enableShareTimeline": true - } - } - ] - }, - { - "root": "taozi", - "pages": [ - { - "path": "home/home", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter1/chapter1", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter2/chapter2", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter3/chapter3", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter4/chapter4", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - } - ] - }, - { - "root": "bmzm", - "pages": [ - { - "path": "home/home", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter1/index", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter2/index", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter3/index", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter4/index", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter5/index", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter6/index", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "chapter7/index", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - } - ] - } - ], - "tabBar": { - "custom": true, - "color": "#333333", - "selectedColor": "#6CA5AA", - "borderStyle": "black", - "backgroundColor": "#ffffff", - "fontSize": "24rpx", - "height": "123rpx", - "iconWidth": "40rpx", - "list": [ - { - "pagePath": "pages/index/index", - "text": "首页", - "visible": false - }, - { - "pagePath": "pages/index/readingBody", - "text": "阅读体", - "visible": false - }, - { - "pagePath": "pages/index/sensoryStore", - "text": "有感商店", - "visible": false - }, - { - "pagePath": "pages/index/intelligentAgent", - "text": "智能体", - "visible": false - }, - { - "pagePath": "pages/index/iSoul", - "text": "iSoul", - "visible": false - } - ] + ] }, - "globalStyle": { - "navigationBarTextStyle": "black", - "navigationBarTitleText": "uni-app", - "navigationBarBackgroundColor": "#F8F8F8", - "backgroundColor": "#F8F8F8" + { + "root": "bmzm", + "pages": [ + { + "path": "home/home", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "chapter1/index", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "chapter2/index", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "chapter3/index", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "chapter4/index", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "chapter5/index", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "chapter6/index", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "chapter7/index", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + } + ] }, - "uniIdRouter": {} -} \ No newline at end of file + { + "root": "pig", + "pages": [ + { + "path": "home/home", + "style": { + "navigationBarTitleText": "", + "navigationBarTextStyle": "white", + + "navigationStyle": "custom" + } + }, + { + "path": "chapter1/chapter1", + "style": { + "navigationBarTitleText": "", + "navigationBarTextStyle": "white", + + "navigationStyle": "custom" + } + }, + { + "path": "chapter2/chapter2", + "style": { + "navigationBarTitleText": "", + "navigationBarTextStyle": "white", + + "navigationStyle": "custom" + } + }, + { + "path": "chapter3/chapter3", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom", + "navigationBarTextStyle": "white" + } + }, + { + "path": "chapter3/brave", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom", + "navigationBarTextStyle": "white" + } + }, + { + "path": "chapter3/sacred", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom", + "navigationBarTextStyle": "white" + } + }, + { + "path": "chapter3/humble", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom", + "navigationBarTextStyle": "white" + } + }, + { + "path": "chapter3/art", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom", + "navigationBarTextStyle": "white" + } + }, + { + "path": "chapter3/smart", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom", + "navigationBarTextStyle": "white" + } + }, + { + "path": "chapter3/stupid", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom", + "navigationBarTextStyle": "white" + } + }, + { + "path": "chapter4/chapter4", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom", + "navigationBarTextStyle": "white" + } + }, + + { + "path": "chapter4/secBuy", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom", + "navigationBarTextStyle": "white" + } + }, + { + "path": "chapter4/first", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom", + "navigationBarTextStyle": "white" + } + }, + { + "path": "chapter4/second", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom", + "navigationBarTextStyle": "white" + } + }, + { + "path": "chapter4/third", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom", + "navigationBarTextStyle": "white" + } + }, + { + "path": "chapter4/fourth", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom", + "navigationBarTextStyle": "white" + } + } + ] + } + ], + "tabBar": { + "custom": true, + "color": "#333333", + "selectedColor": "#6CA5AA", + "borderStyle": "black", + "backgroundColor": "#ffffff", + "fontSize": "24rpx", + "height": "123rpx", + "iconWidth": "40rpx", + "list": [ + { + "pagePath": "pages/index/index", + "text": "首页", + "visible": false + }, + { + "pagePath": "pages/index/readingBody", + "text": "阅读体", + "visible": false + }, + { + "pagePath": "pages/index/sensoryStore", + "text": "有感商店", + "visible": false + }, + { + "pagePath": "pages/index/intelligentAgent", + "text": "智能体", + "visible": false + }, + { + "pagePath": "pages/index/iSoul", + "text": "iSoul", + "visible": false + } + ] + }, + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "uni-app", + "navigationBarBackgroundColor": "#F8F8F8", + "backgroundColor": "#F8F8F8" + }, + "uniIdRouter": {} +} diff --git a/pig/chapter1/chapter1.vue b/pig/chapter1/chapter1.vue new file mode 100644 index 0000000..58345e6 --- /dev/null +++ b/pig/chapter1/chapter1.vue @@ -0,0 +1,330 @@ + + + + + diff --git a/pig/chapter2/chapter2.vue b/pig/chapter2/chapter2.vue new file mode 100644 index 0000000..165e061 --- /dev/null +++ b/pig/chapter2/chapter2.vue @@ -0,0 +1,369 @@ + + + + + diff --git a/pig/chapter3/art.vue b/pig/chapter3/art.vue new file mode 100644 index 0000000..0688a1a --- /dev/null +++ b/pig/chapter3/art.vue @@ -0,0 +1,83 @@ + + + + \ No newline at end of file diff --git a/pig/chapter3/brave.vue b/pig/chapter3/brave.vue new file mode 100644 index 0000000..2501452 --- /dev/null +++ b/pig/chapter3/brave.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/pig/chapter3/chapter3.vue b/pig/chapter3/chapter3.vue new file mode 100644 index 0000000..168ce3b --- /dev/null +++ b/pig/chapter3/chapter3.vue @@ -0,0 +1,426 @@ + + + + + diff --git a/pig/chapter3/humble.vue b/pig/chapter3/humble.vue new file mode 100644 index 0000000..ad8894a --- /dev/null +++ b/pig/chapter3/humble.vue @@ -0,0 +1,83 @@ + + + + \ No newline at end of file diff --git a/pig/chapter3/sacred.vue b/pig/chapter3/sacred.vue new file mode 100644 index 0000000..da7de4a --- /dev/null +++ b/pig/chapter3/sacred.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/pig/chapter3/smart.vue b/pig/chapter3/smart.vue new file mode 100644 index 0000000..f0724ab --- /dev/null +++ b/pig/chapter3/smart.vue @@ -0,0 +1,83 @@ + + + + \ No newline at end of file diff --git a/pig/chapter3/stupid.vue b/pig/chapter3/stupid.vue new file mode 100644 index 0000000..410bf22 --- /dev/null +++ b/pig/chapter3/stupid.vue @@ -0,0 +1,83 @@ + + + + \ No newline at end of file diff --git a/pig/chapter4/chapter4.vue b/pig/chapter4/chapter4.vue new file mode 100644 index 0000000..ffe34af --- /dev/null +++ b/pig/chapter4/chapter4.vue @@ -0,0 +1,644 @@ + + + + + diff --git a/pig/chapter4/first.vue b/pig/chapter4/first.vue new file mode 100644 index 0000000..c7bd40d --- /dev/null +++ b/pig/chapter4/first.vue @@ -0,0 +1,109 @@ + + + + diff --git a/pig/chapter4/fourth.vue b/pig/chapter4/fourth.vue new file mode 100644 index 0000000..c367f38 --- /dev/null +++ b/pig/chapter4/fourth.vue @@ -0,0 +1,109 @@ + + + + diff --git a/pig/chapter4/secBuy.vue b/pig/chapter4/secBuy.vue new file mode 100644 index 0000000..14d1762 --- /dev/null +++ b/pig/chapter4/secBuy.vue @@ -0,0 +1,155 @@ + + + + diff --git a/pig/chapter4/second.vue b/pig/chapter4/second.vue new file mode 100644 index 0000000..54a1abb --- /dev/null +++ b/pig/chapter4/second.vue @@ -0,0 +1,109 @@ + + + + diff --git a/pig/chapter4/third.vue b/pig/chapter4/third.vue new file mode 100644 index 0000000..61effa3 --- /dev/null +++ b/pig/chapter4/third.vue @@ -0,0 +1,109 @@ + + + + diff --git a/pig/home/home.vue b/pig/home/home.vue new file mode 100644 index 0000000..c8043a4 --- /dev/null +++ b/pig/home/home.vue @@ -0,0 +1,1005 @@ + + + + + diff --git a/uni_modules/uni-transition/components/uni-transition/createAnimation.js b/uni_modules/uni-transition/components/uni-transition/createAnimation.js index 5f54365..6935b5b 100644 --- a/uni_modules/uni-transition/components/uni-transition/createAnimation.js +++ b/uni_modules/uni-transition/components/uni-transition/createAnimation.js @@ -122,7 +122,29 @@ animateTypes1.concat(animateTypes2, animateTypes3).forEach(type => { }) export function createAnimation(option, _this) { - if(!_this) return + if(!_this) { + console.warn('uni-transition: _this parameter is undefined, returning empty animation object') + // 创建一个完整的空动画对象,确保所有方法都返回自身以支持链式调用 + const emptyAnimation = {} + // 添加step和run方法 + emptyAnimation.step = function(config = {}) { + return emptyAnimation + } + emptyAnimation.run = function(fn) { + typeof fn === 'function' && fn() + return emptyAnimation + } + // 添加所有动画类型方法 + const allAnimateTypes = ['matrix', 'matrix3d', 'rotate', 'rotate3d', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scale3d', + 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'translate', 'translate3d', 'translateX', 'translateY', + 'translateZ', 'opacity', 'backgroundColor', 'width', 'height', 'left', 'right', 'top', 'bottom'] + allAnimateTypes.forEach(type => { + emptyAnimation[type] = function(...args) { + return emptyAnimation + } + }) + return emptyAnimation + } clearTimeout(_this.timer) return new MPAnimation(option, _this) } diff --git a/uni_modules/uni-transition/components/uni-transition/uni-transition.vue b/uni_modules/uni-transition/components/uni-transition/uni-transition.vue index 0d739bd..7c29a23 100644 --- a/uni_modules/uni-transition/components/uni-transition/uni-transition.vue +++ b/uni_modules/uni-transition/components/uni-transition/uni-transition.vue @@ -127,7 +127,7 @@ export default { * @param {Object} obj */ step(obj, config = {}) { - if (!this.animation) return + if (!this.animation || typeof this.animation.step !== 'function') return this for (let i in obj) { try { if(typeof obj[i] === 'object'){ @@ -146,7 +146,7 @@ export default { * ref 触发 执行动画 */ run(fn) { - if (!this.animation) return + if (!this.animation || typeof this.animation.run !== 'function') return this.animation.run(fn) }, // 开始过度动画 @@ -163,9 +163,20 @@ export default { this.$nextTick(() => { // TODO 定时器保证动画完全执行,目前有些问题,后面会取消定时器 this.timer = setTimeout(() => { - this.animation = createAnimation(this.config, this) - this.tranfromInit(false).step() - this.animation.run() + try { + this.animation = createAnimation(this.config, this) + if (this.animation && typeof this.animation.step === 'function' && typeof this.animation.run === 'function') { + const result = this.tranfromInit(false) + if (result && typeof result.step === 'function') { + result.step() + if (typeof this.animation.run === 'function') { + this.animation.run() + } + } + } + } catch (error) { + console.error('uni-transition animation error:', error) + } this.$emit('change', { detail: this.isShow }) @@ -174,20 +185,35 @@ export default { }, // 关闭过度动画 close(type) { - if (!this.animation) return - this.tranfromInit(true) - .step() - .run(() => { - this.isShow = false - this.animationData = null - this.animation = null - let { opacity, transform } = this.styleInit(false) - this.opacity = opacity || 1 - this.transform = transform - this.$emit('change', { - detail: this.isShow - }) + if (!this.animation || typeof this.animation.step !== 'function' || typeof this.animation.run !== 'function') return + try { + const result = this.tranfromInit(true) + if (result && typeof result.step === 'function') { + result.step() + if (typeof result.run === 'function') { + result.run(() => { + this.isShow = false + this.animationData = null + this.animation = null + let { opacity, transform } = this.styleInit(false) + this.opacity = opacity || 1 + this.transform = transform + this.$emit('change', { + detail: this.isShow + }) + }) + } + } + } catch (error) { + console.error('uni-transition close animation error:', error) + // 发生错误时直接关闭 + this.isShow = false + this.animationData = null + this.animation = null + this.$emit('change', { + detail: this.isShow }) + } }, // 处理动画开始前的默认样式 styleInit(type) { @@ -212,6 +238,10 @@ export default { }, // 处理内置组合动画 tranfromInit(type) { + if (!this.animation) { + console.warn('uni-transition: animation object is not initialized') + return this.animation + } let buildTranfrom = (type, mode) => { let aniNum = null if (mode === 'fade') { @@ -231,7 +261,10 @@ export default { aniNum = type ? '100%' : '0' } } - this.animation[this.animationMode()[mode]](aniNum) + const animationMethod = this.animationMode()[mode] + if (this.animation && typeof this.animation[animationMethod] === 'function') { + this.animation[animationMethod](aniNum) + } } if (typeof this.modeClass === 'string') { buildTranfrom(type, this.modeClass)