Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-component
提交
e2885e44
U
uni-component
项目概览
DCloud
/
uni-component
通知
250
Star
6
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-component
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
e2885e44
编写于
1月 31, 2023
作者:
Y
yurj26
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: add h5 animation-view
上级
a5fe7b88
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
17887 addition
and
35 deletion
+17887
-35
pages/index/index.vue
pages/index/index.vue
+41
-35
uni_modules/animation-view-h5/changelog.md
uni_modules/animation-view-h5/changelog.md
+0
-0
uni_modules/animation-view-h5/components/animation-view-h5/animation-view-h5.vue
...iew-h5/components/animation-view-h5/animation-view-h5.vue
+107
-0
uni_modules/animation-view-h5/components/animation-view-h5/lottie.js
.../animation-view-h5/components/animation-view-h5/lottie.js
+17640
-0
uni_modules/animation-view-h5/package.json
uni_modules/animation-view-h5/package.json
+86
-0
uni_modules/animation-view-h5/readme.md
uni_modules/animation-view-h5/readme.md
+0
-0
uni_modules/uni-animation-view/utssdk/web/index.vue
uni_modules/uni-animation-view/utssdk/web/index.vue
+13
-0
未找到文件。
pages/index/index.vue
浏览文件 @
e2885e44
<
template
>
<
template
>
<view
class=
"content"
>
<div>
<image
class=
"logo"
src=
"/static/logo.png"
></image>
<animation-view-h5
class=
"animation"
:path=
"path"
:loop=
"loop"
:autoplay=
"autoplay"
:action=
"action"
<view
class=
"text-area"
>
:hidden=
"hidden"
@
bindended=
"lottieEnd"
>
<text
class=
"title"
>
{{
title
}}
</text>
</animation-view-h5>
</view>
<button
@
click=
"playLottie"
type=
"primary"
>
{{
status
}}
lottie动画
</button>
</view>
<button
@
click=
"changeLottie"
type=
"primary"
>
切换
{{
location
}}
动画
</button>
<button
@
click=
"changeLottieDisplay"
type=
"primary"
>
{{
display
}}
动画
</button>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
title
:
'
Hello
'
path
:
'
/uni_modules/uni-animation-view/static/lottie.json
'
,
loop
:
false
,
autoplay
:
false
,
action
:
'
stop
'
,
hidden
:
false
,
status
:
'
播放
'
,
location
:
'
网络
'
,
display
:
'
隐藏
'
}
}
},
onLoad
()
{
},
},
methods
:
{
methods
:
{
playLottie
()
{
this
.
action
=
(
'
play
'
!==
this
.
action
)
?
'
play
'
:
'
pause
'
;
this
.
status
=
(
'
pause
'
===
this
.
action
)
?
'
播放
'
:
'
暂停
'
;
},
changeLottie
()
{
this
.
action
=
'
stop
'
;
this
.
status
=
'
播放
'
;
this
.
path
=
(
'
网络
'
===
this
.
location
)
?
'
https://native-res.dcloud.net.cn/uni-app/static/lottie.json
'
:
'
/uni_modules/uni-animation-view/static/lottie.json
'
;
this
.
location
=
(
'
网络
'
===
this
.
location
)
?
'
本地
'
:
'
网络
'
;
console
.
log
(
'
path=
'
+
this
.
path
);
},
changeLottieDisplay
()
{
this
.
hidden
=
!
this
.
hidden
;
this
.
display
=
this
.
hidden
?
'
显示
'
:
'
隐藏
'
;
},
lottieEnd
()
{
this
.
status
=
'
播放
'
;
this
.
action
=
'
stop
'
;
console
.
log
(
'
动画播放结束
'
);
}
}
}
}
}
</
script
>
</
script
>
<
style
>
<
style
>
.content
{
.animation
{
display
:
flex
;
width
:
750
rpx
;
flex-direction
:
column
;
height
:
300
rpx
;
align-items
:
center
;
background-color
:
#CCCCCC
;
justify-content
:
center
;
margin-bottom
:
20px
;
}
.logo
{
height
:
200
rpx
;
width
:
200
rpx
;
margin-top
:
200
rpx
;
margin-left
:
auto
;
margin-right
:
auto
;
margin-bottom
:
50
rpx
;
}
.text-area
{
display
:
flex
;
justify-content
:
center
;
}
.title
{
font-size
:
36
rpx
;
color
:
#8f8f94
;
}
}
</
style
>
</
style
>
uni_modules/animation-view-h5/changelog.md
0 → 100644
浏览文件 @
e2885e44
uni_modules/animation-view-h5/components/animation-view-h5/animation-view-h5.vue
0 → 100644
浏览文件 @
e2885e44
<
template
>
<view
v-show=
"!hidden"
ref=
"animation"
>
</view>
</
template
>
<
script
>
import
lottie
from
'
./lottie.js
'
export
default
{
name
:
'
animation-view
'
,
props
:
{
/**
* 动画资源地址,支持远程 URL 地址和本地绝对路径
*/
"
path
"
:
{
type
:
String
,
default
:
""
},
/**
* 动画是否自动播放
*/
"
autoplay
"
:
{
type
:
Boolean
,
default
:
false
},
/**
* 动画是否循环播放
*/
"
loop
"
:
{
type
:
Boolean
,
default
:
false
},
/**
* 是否隐藏动画
*/
"
hidden
"
:
{
type
:
Boolean
,
default
:
true
},
/**
* 动画操作,可取值 play、pause、stop
*/
"
action
"
:
{
type
:
String
,
default
:
"
play
"
,
validator
:
(
value
)
=>
{
return
[
'
play
'
,
'
pause
'
,
'
stop
'
].
includes
(
value
)
}
}
},
watch
:
{
path
(
val
)
{
this
.
init
()
},
action
(
val
)
{
switch
(
val
)
{
case
"
play
"
:
this
.
play
()
break
case
"
pause
"
:
this
.
pause
()
break
case
"
stop
"
:
this
.
stop
()
break
default
:
break
}
}
},
data
()
{
return
{
animation
:
null
}
},
mounted
()
{
this
.
init
()
},
methods
:
{
init
()
{
if
(
this
.
animation
)
{
this
.
animation
.
destroy
()
}
// 初始化
this
.
animation
=
lottie
.
loadAnimation
({
path
:
this
.
path
,
loop
:
this
.
loop
,
autoplay
:
this
.
autoplay
,
loop
:
this
.
loop
,
container
:
this
.
$refs
.
animation
.
$el
})
// 动画结束
this
.
animation
.
onComplete
=
()
=>
{
this
.
$emit
(
'
bindended
'
)
}
},
play
()
{
this
.
animation
?.
play
()
},
pause
()
{
this
.
animation
?.
pause
()
},
stop
()
{
this
.
animation
?.
stop
()
},
}
}
</
script
>
\ No newline at end of file
uni_modules/animation-view-h5/components/animation-view-h5/lottie.js
0 → 100644
浏览文件 @
e2885e44
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
uni_modules/animation-view-h5/package.json
0 → 100644
浏览文件 @
e2885e44
{
"id"
:
"animation-view-h5"
,
"displayName"
:
"animation-view"
,
"version"
:
"1.0.0"
,
"description"
:
"使用uts组件开发,实现animation-view组件"
,
"keywords"
:
[
"animation-view"
,
"lottie"
],
"repository"
:
""
,
"engines"
:
{
"HBuilderX"
:
"^3.7.0"
},
"dcloudext"
:
{
"type"
:
"component-uts"
,
"sale"
:
{
"regular"
:
{
"price"
:
"0.00"
},
"sourcecode"
:
{
"price"
:
"0.00"
}
},
"contact"
:
{
"qq"
:
""
},
"declaration"
:
{
"ads"
:
"无"
,
"data"
:
"插件不采集任何数据"
,
"permissions"
:
"无"
},
"npmurl"
:
""
},
"uni_modules"
:
{
"dependencies"
:
[],
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"y"
,
"aliyun"
:
"y"
},
"client"
:
{
"Vue"
:
{
"vue2"
:
"y"
,
"vue3"
:
"y"
},
"App"
:
{
"app-android"
:
{
"minVersion"
:
"21"
},
"app-ios"
:
{
"minVersion"
:
"11"
}
},
"H5-mobile"
:
{
"Safari"
:
"u"
,
"Android Browser"
:
"u"
,
"微信浏览器(Android)"
:
"u"
,
"QQ浏览器(Android)"
:
"u"
},
"H5-pc"
:
{
"Chrome"
:
"u"
,
"IE"
:
"u"
,
"Edge"
:
"u"
,
"Firefox"
:
"u"
,
"Safari"
:
"u"
},
"小程序"
:
{
"微信"
:
"u"
,
"阿里"
:
"u"
,
"百度"
:
"u"
,
"字节跳动"
:
"u"
,
"QQ"
:
"u"
,
"钉钉"
:
"u"
,
"快手"
:
"u"
,
"飞书"
:
"u"
,
"京东"
:
"u"
},
"快应用"
:
{
"华为"
:
"u"
,
"联盟"
:
"u"
}
}
}
}
}
uni_modules/animation-view-h5/readme.md
0 → 100644
浏览文件 @
e2885e44
uni_modules/uni-animation-view/utssdk/web/index.vue
0 → 100644
浏览文件 @
e2885e44
<
template
>
<view>
</view>
</
template
>
<
script
>
export
default
{
name
:
"
uni-animation-view
"
,
data
()
{
return
{}
}
}
</
script
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录