提交 dda89f66 编写于 作者: DCloud_iOS_XHY's avatar DCloud_iOS_XHY

修改 iOS Lottie 插件读取资源文件的方式

上级 16afebf0
......@@ -10,7 +10,7 @@
<button @tap="changeAction(3)">测试action stop</button>
<animation-view ref="animView" :path="animUrl" :autoplay="autoplay" :loop="loop" :action="action"
:hidden="hidden" @bindended="testAnimEnd" @click="lottieClickTest" @longpress="lottieLongpressTest"
:style="{width:widthNum+'px',height:heightNum+'px',background:yanse}">
:style="{width:widthNum+'rpx',height:heightNum+'px',background:yanse}">
</animation-view>
</div>
......@@ -26,7 +26,7 @@
action: "play",
loop: false,
yanse: "red",
widthNum: 375,
widthNum: 750,
heightNum: 200,
comShow: true,
animUrl: "anim_a.json"
......@@ -39,10 +39,10 @@
this.autoplay = !this.autoplay
},
changeUrl: function() {
if (this.animUrl == "anim_a.json") {
this.animUrl = "anim_b.json"
if (this.animUrl == "/static/anim_a.json") {
this.animUrl = "/static/anim_b.json"
} else {
this.animUrl = "anim_a.json"
this.animUrl = "/static/anim_a.json"
}
},
......
......@@ -16,6 +16,7 @@
import {
UIView
} from "UIKit"
import { UTSiOS } from "DCloudUTSFoundation"
//原生提供以下属性或方法的实现
......@@ -159,10 +160,8 @@
if (this.path.hasPrefix("http")) {
animationUrl = new URL(string = this.path)
} else {
var filePath = Bundle.main.path(forResource = this.path, ofType = null)
if (filePath != null) {
animationUrl = new URL(fileURLWithPath = filePath!)
}
const filePath = UTSiOS.getResourcePath(this.path)
animationUrl = new URL(fileURLWithPath = filePath)
}
if (animationUrl != null) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册