小程序提示组件缺少method to handle event,为什么会这样?

method命名都检查都正确,死活提示缺少method。

这是报错:

Component "pages/classic" does not have a method "onPrevious" to handle event "right".
//这里是子组件中的methods 和 wxml

  methods: {
    onNext: function (event) {
      if (!this.properties.latest) {
        this.triggerEvent('left', {}, {})
      }
    },

    onPrevious: function (event) {
      if (!this.properties.first) {
        this.triggerEvent('right', {}, {})
      }
    }
   }

---------------------------------------------
<view class="container">
  <image bind:tap="onNext" class="icon" src="{{latest?disLeftSrc:leftSrc}}"/>
  <text class="title">{{title}}</text>
  <image bind:tap="onPrevious" class="icon" src="{{first?disRightSrc:rightSrc}}"/>
</view>


这里是page中的结构
<navi-cmp bind:left="onNext" bind:right="onPrevious" title="{{classic.title}}" 
first="{{first}}" latest="{{latest}}" class="navi" />
阅读 16k
1 个回答
✓ 已被采纳新手上路,请多包涵

。。。。。。。。。。。。。

行吧,原来page.js中的方法也应该写上相同的onNext方法

推荐问题