60 lines
1.1 KiB
JavaScript
60 lines
1.1 KiB
JavaScript
import lottie from 'lottie-miniprogram'
|
||
|
||
Component({
|
||
|
||
/**
|
||
* Component properties
|
||
*/
|
||
properties: {
|
||
|
||
},
|
||
|
||
/**
|
||
* Component initial data
|
||
*/
|
||
data: {
|
||
|
||
},
|
||
|
||
|
||
lifetimes: {
|
||
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
||
ready: function () {
|
||
return;
|
||
this.createSelectorQuery().select('.canvas').node(res => {
|
||
const canvas = res.node
|
||
canvas.width = 1080;
|
||
canvas.height = 1920;
|
||
lottie.setup(canvas)
|
||
var context = canvas.getContext('2d');
|
||
this.ani = lottie.loadAnimation({
|
||
loop: true,
|
||
autoplay: true,
|
||
path: 'https://emblem-resources.oss-cn-guangzhou.aliyuncs.com/scan-guide-0430.0.json',
|
||
rendererSettings: {
|
||
context,
|
||
},
|
||
});
|
||
}).exec()
|
||
},
|
||
moved: function () { },
|
||
detached: function () {
|
||
this.ani.destroy();
|
||
},
|
||
},
|
||
|
||
/**
|
||
* Component methods
|
||
*/
|
||
methods: {
|
||
show_service() {
|
||
this.triggerEvent('service', {}, {});
|
||
},
|
||
go_back() {
|
||
this.triggerEvent('back', {}, {});
|
||
},
|
||
|
||
},
|
||
|
||
})
|