button按键,苹果ios调试出现异常,Android调试正常?
发布于 6 年前 作者 ushi 4471 次浏览 来自 官方Issues

请问下我遇到一个现象,就是苹果ios调试和Android调试的不同

js文件:

btnclick2: function (event) {

wx.navigateTo({

url: '../Reservation/Reservation'

})

},

Android手机调试可以正常跳转,

ios手机调试异常显示:

[publib]:2 Component "pages/index/index" does not have a method "btnclick2" to handle event "tap".

请教大佬,这是什么原因呢

2 回复

Component 组件需要将方法写在methods{} 中。像这样。

methods{
  btnclick2function (event) {
  
    wx.navigateTo({
  
      url'../Reservation/Reservation'
    
    })

  },
}
Component 的方法写在methods里
回到顶部