收藏
回答

this.animate is not defined为什么方法未找到?

我是看教程写的关键帧动画,教程代码地址:https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html

我写的方法是

onLoad: function () {

this.setData({

statusBarHeight: app.globalData.statusBarHeight,

navBarHeight: app.globalData.navBarHeight

});

this.animate('.dialog_body', [

{ scale: [0.3, 0.3], ease: 'ease-out' },

{ scale: [1, 1], ease: 'ease-in' },

], 1000);

},

编译的时候报错

VM461:1 thirdScriptError

this.animate is not a function;at pages/filterdialog/filterdialog page lifeCycleMethod onLoad function

TypeError: this.animate is not a function

    at l.onLoad (http://127.0.0.1:26109/appservice/pages/filterdialog/filterdialog.js:58:10)

    at l.(http://127.0.0.1:26109/appservice/__dev__/WAService.js:1:1569573)

    at l.__callPageLifeTime__ (http://127.0.0.1:26109/appservice/__dev__/WAService.js:1:1569313)

    at Tt (http://127.0.0.1:26109/appservice/__dev__/WAService.js:1:1588940)

    at http://127.0.0.1:26109/appservice/__dev__/WAService.js:1:1592274

    at xt (http://127.0.0.1:26109/appservice/__dev__/WAService.js:1:1592767)

    at Function.(http://127.0.0.1:26109/appservice/__dev__/WAService.js:1:1596300)

    at i.(http://127.0.0.1:26109/appservice/__dev__/WAService.js:1:1565163)

    at i.emit (http://127.0.0.1:26109/appservice/__dev__/WAService.js:1:574700)

    at Object.emit (http://127.0.0.1:26109/appservice/__dev__/WAService.js:1:562185)

console.error @ VM461:1

errorReport @ VM478 WAService.js:1

thirdErrorReport @ VM478 WAService.js:1

(anonymous) @ VM478 WAService.js:1

(anonymous) @ VM478 WAService.js:1

__callPageLifeTime__ @ VM478 WAService.js:1

Tt @ VM478 WAService.js:1

(anonymous) @ VM478 WAService.js:1

xt @ VM478 WAService.js:1

(anonymous) @ VM478 WAService.js:1

(anonymous) @ VM478 WAService.js:1

i.emit @ VM478 WAService.js:1

emit @ VM478 WAService.js:1

(anonymous) @ VM478 WAService.js:1

(anonymous) @ VM478 WAService.js:1

n @ VM476 asdebug.js:1

(anonymous) @ VM476 asdebug.js:1

(anonymous) @ VM476 asdebug.js:1

_ws.onmessage @ VM476 asdebug.js:1

VM527:4 Tue Dec 17 2019 16:33:18 GMT+0800 (中国标准时间) sitemap 索引情况提示

VM461:1  根据 sitemap 的规则[0],当前页面 [pages/filterdialog/filterdialog] 将被索引

console.warn @ VM461:1

(anonymous) @ VM527:6

(anonymous) @ VM527:13...

请问为什么官方实例代码不报这个错,而我就报这个错

回答关注问题邀请回答
收藏

2 个回答

  • tcyeee
    tcyeee
    01-13

    玄学bug,我也遇到了,然后我把官方的代码完全复制到了自己的项目中,官方的代码也报错了,折腾了一天了,现在还在排查

    01-13
    赞同
    回复
  • undefined
    undefined
    2019-12-17
    基础库多少
    2019-12-17
    赞同
    回复 4
    • 吴明翰
      吴明翰
      2019-12-17
      2.9.4
      2019-12-17
      回复
    • 吴明翰
      吴明翰
      2019-12-17
      是不是跟createAnimation不能共存,我这页原有代码调用了这个旧的方法
      2019-12-17
      回复
    • 吴明翰
      吴明翰
      2019-12-17
      我发现是页面的json少了"usingComponents": {}
      2019-12-17
      回复
    • undefined
      undefined
      2019-12-17回复吴明翰
      https://developers.weixin.qq.com/s/1wtkHGmp71da  不报错啊
      2019-12-17
      回复
登录 后发表内容
问题标签