提交 d4527386 编写于 作者: H hdx

feat(AnimationFrame): 合并 requestAnimationFrame/cancelAnimationFrame 为一个页面

上级 48b62ca8
...@@ -546,17 +546,10 @@ ...@@ -546,17 +546,10 @@
} }
}, },
{ {
"path": "pages/API/request-animation-frame/request-animation-frame", "path": "pages/API/animation-frame/animation-frame",
"group": "1,4,9,0", "group": "1,4,9,0",
"style": { "style": {
"navigationBarTitleText": "requestAnimationFrame | 加入请求帧动画队列" "navigationBarTitleText": "AnimationFrame | 帧动画"
}
},
{
"path": "pages/API/cancel-animation-frame/cancel-animation-frame",
"group": "1,4,9,1",
"style": {
"navigationBarTitleText": "cancelAnimationFrame | 取消已加入的帧动画队列"
} }
}, },
{ {
......
const PAGE_PATH = '/pages/API/cancel-animation-frame/cancel-animation-frame' const PAGE_PATH = '/pages/API/animation-frame/animation-frame'
describe('API-cancelAnimationFrame', () => { describe('API-cancelAnimationFrame', () => {
let page let page
......
const PAGE_PATH = '/pages/API/request-animation-frame/request-animation-frame'
describe('API-requestAnimationFrame', () => {
let page
beforeAll(async () => {
page = await program.reLaunch(PAGE_PATH)
await page.waitFor(600);
});
it('requestAnimationFrame', async () => {
await page.callMethod('startRequestAnimationFrame')
await page.waitFor(100)
const data = await page.data()
expect(data.testFrameCount > 0).toBe(true)
});
});
<template>
<view class="page">
<page-head :title="title"></page-head>
<button @click="startRequestAnimationFrame">requestAnimationFrame</button>
<text class="frame-count">{{testFrameCount}}</text>
</view>
</template>
<script>
export default {
data() {
return {
title: 'requestAnimationFrame',
testFrameCount: 0
}
},
methods: {
startRequestAnimationFrame() {
requestAnimationFrame((_ : number) => {
this.testFrameCount++;
})
}
}
}
</script>
<style>
.page {
padding: 15px;
}
.frame-count {
margin-top: 15px;
}
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册