Skip to content

feat(x-mp): 支持小程序 animate oncancel 回调 - #6020

Merged
chouchouji merged 3 commits into
uni-app-vue3-devfrom
feat-animation-on-cancel-event
Jul 3, 2026
Merged

chouchouji merged 3 commits into
uni-app-vue3-devfrom
feat-animation-on-cancel-event

Conversation

@chouchouji

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the uni-mp-vue mini-program animation implementation to better match Web Animations behavior by supporting the animate oncancel callback and aligning initial play state semantics.

Changes:

  • Initialize UniAnimation’s internal _playState to 'idle' by default.
  • Dispatch oncancel when cancel() is called from a non-idle state.
  • Add a small helper to construct the playback event object passed to oncancel.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 47 to +60
@@ -54,6 +55,9 @@ export class UniAnimation implements IUniAnimation {
}),
})
this._playState = 'idle'
if (shouldDispatchCancel) {
this.oncancel?.(createUniAnimationPlaybackEvent('cancel'))
}
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

Size report

Path Size
packages/size-check/dist/size-check.es.js 52.91 KB (0%)
packages/size-check/dist/style.css 2.83 KB (0%)
packages/uni-app/dist/uni-app.es.js 2.41 KB (0%)
packages/uni-h5-vue/dist/vue.runtime.esm.js 76.48 KB (0%)
packages/uni-mp-vue/dist/vue.runtime.esm.js 43.97 KB (0%)
packages/uni-mp-alipay/dist/uni.api.esm.js 15.53 KB (0%)
packages/uni-mp-alipay/dist/uni.mp.esm.js 8.76 KB (0%)
packages/uni-mp-baidu/dist/uni.api.esm.js 11.79 KB (0%)
packages/uni-mp-baidu/dist/uni.mp.esm.js 10.27 KB (0%)
packages/uni-mp-qq/dist/uni.api.esm.js 11.13 KB (0%)
packages/uni-mp-qq/dist/uni.mp.esm.js 8.29 KB (0%)
packages/uni-mp-toutiao/dist/uni.api.esm.js 11.07 KB (0%)
packages/uni-mp-toutiao/dist/uni.mp.esm.js 9.96 KB (0%)
packages/uni-mp-weixin/dist/uni.api.esm.js 12.21 KB (0%)
packages/uni-mp-weixin/dist/uni.mp.esm.js 8.84 KB (0%)
packages/uni-quickapp-webview/dist/uni.api.esm.js 11.07 KB (0%)
packages/uni-quickapp-webview/dist/uni.mp.esm.js 8.71 KB (0%)

@chouchouji
chouchouji merged commit 29b27bd into uni-app-vue3-dev Jul 3, 2026
3 of 4 checks passed
@chouchouji
chouchouji deleted the feat-animation-on-cancel-event branch July 3, 2026 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants