Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_38785028
unidocs-zh
提交
77f8fa60
U
unidocs-zh
项目概览
qq_38785028
/
unidocs-zh
与 Fork 源项目一致
Fork自
DCloud / unidocs-zh
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
unidocs-zh
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
77f8fa60
编写于
1月 14, 2023
作者:
DCloud-yyl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增animation-view组件规范
上级
86d9cb13
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
80 addition
and
0 deletion
+80
-0
docs/component/animation-view.md
docs/component/animation-view.md
+80
-0
未找到文件。
docs/component/animation-view.md
0 → 100644
浏览文件 @
77f8fa60
#### animation-view
Lottie动画组件,动画资源参考
[
Lottie官方接
](
https://airbnb.design/lottie/
)
。
> animation-view组件是[uts组件](https://uniapp.dcloud.net.cn/plugin/uts-component.html),需下载插件:[animation-view](https://ext.dcloud.net.cn/?cat1=8&cat2=81),仅App端nvue页面支持
> [uts组件](https://uniapp.dcloud.net.cn/plugin/uts-component.html)需 HBuilderX 3.7.0+
> App端真机运行需要打[自定义基座](https://uniapp.dcloud.net.cn/tutorial/run/run-app.html#customplayground)
**平台差异说明**
|App|H5|微信小程序|支付宝小程序|百度小程序|字节跳动小程序、飞书小程序|QQ小程序|快应用|360小程序|快手小程序|京东小程序|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|√|x|x|x|x|x|x|x|x|x|x|
**属性说明**
|属性名|类型|默认值|说明|
|:-|:-|:-|:-|
| path | String | | 动画资源地址,支持本地路径和网络路径 |
| loop | Boolean | false | 动画是否循环播放 |
| autoplay | Boolean | true | 动画是否自动播放 |
| action | String | play | 动画操作,可取值 play、pause、stop |
| hidden | Boolean | true | 是否隐藏动画 |
| @bindended | EventHandle | | 当播放到末尾时触发 ended 事件(自然播放结束会触发回调,循环播放结束及手动停止动画不会触发) |
**注意**
*
animation-view 仅App端nvue页面支持
*
App端实现使用了Lottie三方SDK,开源项目:
[
Lottie for Android
](
https://github.com/airbnb/lottie-android
)
,
[
Lottie for iOS
](
https://github.com/airbnb/lottie-ios
)
*
App-Android平台要求Android5(API Leavel 21)及以上系统
*
App-iOS平台要求iOS11及以上版本系统
**代码示例**
```
html
<template>
<div>
<animation-view
class=
"animation"
:path=
"path"
:loop=
"loop"
:autoplay=
"autoplay"
:action=
"action"
:hidden=
"hidden"
@
bindended=
"lottieEnd"
>
</animation-view>
<button
@
click=
"playLottie"
type=
"primary"
>
{{status}}lottie动画
</button>
</div>
</template>
<script>
export
default
{
data
()
{
return
{
path
:
"
/uni_modules/uni-animation-view/static/lottie.json
"
,
loop
:
false
,
autoplay
:
false
,
action
:
"
play
"
,
hidden
:
false
,
status
:
"
暂停
"
}
},
methods
:
{
playLottie
()
{
this
.
action
=
(
'
pause
'
===
this
.
action
)
?
'
play
'
:
'
pause
'
;
this
.
status
=
(
'
pause
'
===
this
.
action
)
?
'
播放
'
:
'
暂停
'
;
},
lottieEnd
()
{
console
.
log
(
"
动画播放结束
"
);
}
}
}
</script>
<style>
.animation
{
width
:
750px
;
height
:
300px
;
}
</style>
```
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录