Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
40085b6e
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5995
Star
90
Fork
162
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
40085b6e
编写于
10月 18, 2023
作者:
张
张磊
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加transition事件示例
上级
c8722361
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
93 addition
and
0 deletion
+93
-0
pages.json
pages.json
+8
-0
pages/component/transition-event/transition-event.test.js
pages/component/transition-event/transition-event.test.js
+16
-0
pages/component/transition-event/transition-event.uvue
pages/component/transition-event/transition-event.uvue
+64
-0
pages/pages.test.js
pages/pages.test.js
+1
-0
pages/tabBar/component.uvue
pages/tabBar/component.uvue
+4
-0
未找到文件。
pages.json
浏览文件 @
40085b6e
...
@@ -1001,6 +1001,14 @@
...
@@ -1001,6 +1001,14 @@
"navigationBarTitleText"
:
"getDrawableContext"
,
"navigationBarTitleText"
:
"getDrawableContext"
,
"enablePullDownRefresh"
:
false
"enablePullDownRefresh"
:
false
}
}
},
{
"path"
:
"pages/component/transition-event/transition-event"
,
"style"
:
{
"navigationBarTitleText"
:
""
,
"enablePullDownRefresh"
:
false
}
}
}
],
],
...
...
pages/component/transition-event/transition-event.test.js
0 → 100644
浏览文件 @
40085b6e
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe
(
'
transition event
'
,
()
=>
{
let
page
;
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/transition-event/transition-event
'
)
await
page
.
waitFor
(
3000
);
});
it
(
'
transitionend
'
,
async
()
=>
{
await
page
.
callMethod
(
'
switchBtn
'
)
await
page
.
waitFor
(
3000
)
expect
(
await
page
.
data
(
"
onTransitionEndTriggr
"
)).
toBe
(
true
)
});
});
pages/component/transition-event/transition-event.uvue
0 → 100644
浏览文件 @
40085b6e
<template>
<!-- #ifdef APP -->
<scroll-view style="flex:1">
<!-- #endif -->
<button @click="switchBtn">{{buttonValue}}</button>
<image class="transition-transform" id="transition-transform" @transitionend="onEnd" src="/static/uni.png"></image>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<script>
export default {
data() {
return {
times: 0,
element: null as Element | null,
isStart: false,
buttonValue: "开启图片旋转",
onTransitionEndTriggr: false
}
},
methods: {
switchBtn() {
if (!this.isStart) {
if (this.element == null) {
this.element = uni.getElementById('transition-transform')
}
this.buttonValue = "关闭图片旋转"
this.times = this.times + 1
this.element!.style.setProperty('transform', 'rotate(' + this.times * 360 + 'deg)')
this.element!.style.setProperty('transition-duration', '2000')
this.isStart = true
} else {
this.isStart = false
this.times = 0
this.buttonValue = "开启图片旋转"
this.element!.style.setProperty('transform', 'rotate(' + this.times * 360 + 'deg)')
this.element!.style.setProperty('transition-duration', '0')
}
},
onEnd() {
if (this.isStart) {
this.times = this.times + 1
this.element!.style.setProperty('transform', 'rotate(' + this.times * 360 + 'deg)')
this.onTransitionEndTriggr = true
}
}
}
}
</script>
<style>
.transition-transform {
width: 400rpx;
height: 400rpx;
margin: 50rpx auto;
border-radius: 200rpx;
transition-duration: 2000;
transition-property: transform;
transition-timing-function: linear;
transform: rotate(0deg);
}
</style>
pages/pages.test.js
浏览文件 @
40085b6e
...
@@ -37,6 +37,7 @@ const pages = [
...
@@ -37,6 +37,7 @@ const pages = [
'
/pages/component/view/view
'
,
'
/pages/component/view/view
'
,
// '/pages/component/web-view/web-view', // 动态内容
// '/pages/component/web-view/web-view', // 动态内容
'
/pages/component/web-view-local/web-view-local
'
,
'
/pages/component/web-view-local/web-view-local
'
,
'
/pages/component/transition-event/transition-event
'
,
// CSS
// CSS
'
/pages/CSS/background/background-color
'
,
'
/pages/CSS/background/background-color
'
,
...
...
pages/tabBar/component.uvue
浏览文件 @
40085b6e
...
@@ -254,6 +254,10 @@ export default {
...
@@ -254,6 +254,10 @@ export default {
name: '通用事件',
name: '通用事件',
url: '/pages/component/general-event/general-event',
url: '/pages/component/general-event/general-event',
enable: true,
enable: true,
},{
name: 'Transition事件',
url: '/pages/component/transition-event/transition-event',
enable: true,
},
},
] as Page[],
] as Page[],
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录