Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS 12.3.2真机使用官网提供的demo catrim.js报错 #5

Closed
syz737 opened this issue Sep 24, 2019 · 3 comments
Closed

IOS 12.3.2真机使用官网提供的demo catrim.js报错 #5

syz737 opened this issue Sep 24, 2019 · 3 comments

Comments

@syz737
Copy link

syz737 commented Sep 24, 2019

image
a24fb20790fbed3180a37e7797e1aee

<style lang="less"> .intro { margin: 30px; text-align: center; } button { margin-top: 10px; } </style>
`

<view class="page">
  <view class="intro">欢迎使用代码片段,可在控制台查看代码片段的说明和文档</view>
  <view style="text-align: center;">
    <canvas id="c1" type="2d" style="display: inline-block; width: 300px; height: 300px;"></canvas>
    <button bindtap="init" style="width: 300px;">init</button>
    <button bindtap="play" style="width: 300px;">play</button>
    <button bindtap="pause" style="width: 300px;">pause</button>
  </view>
</view>

`

`
import wepy from 'wepy'
import lottie from '../utils/lottie'

export default class LongList extends wepy.page {
data = {
}
components = {
}

methods= {
  init() {
    if (this._inited) {
      return
    }
    wx.createSelectorQuery().selectAll('#c1').node(res => {
      const canvas = res[0].node
      const context = canvas.getContext('2d')

      canvas.width = 300
      canvas.height = 300

      lottie.setup(canvas)
      this.ani = lottie.loadAnimation({
        loop: true,
        autoplay: false,
        animationData: require('../utils/catrim.js'),
        // path: 'https://whaletest.21kunpeng.com/static_pages/js',
        rendererSettings: {
          context
        }
      })
      this._inited = true
    }).exec()
  },
  play() {
    this.ani.play()
  },
  pause() {
    this.ani.pause()
  }
}

onLoad(options) {
}

onShow () {
  console.log('test.onShow')
}

onUnload() {
}

}
`
界面显示都正常,插件、资源都在utils文件夹下引用也正常,就是canvas报错渲染不出来

@seasonhuang
Copy link
Collaborator

小程序 canvas 接口还不支持真机调试,你试下直接预览可以不?

@syz737
Copy link
Author

syz737 commented Oct 21, 2019

小程序 canvas 接口还不支持真机调试,你试下直接预览可以不?

直接预览没有问题~不支持真机调试,那写完的功能,发布之后在真机上可以直接使用?

@seasonhuang
Copy link
Collaborator

可以先直接预览确认有没有问题,预览没问题发布也就没问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants