• 赚钱入口【需求资源】限时招募流量主、渠道主,站长合作;【合作模式】CPS长期分成,一次推广永久有收益。主动打款,不扣量;

[Vue warn]: Property or method ‘handleChange’ is not defined on the instance but referenced during render

Vue cps12345 9个月前 (09-03) 669次浏览 0个评论

代码:

<v-col cols="12" sm="6" v-for="item in items">
   <v-text-field
      :label="item"
      @change="handleChange(item)"
   ></v-text-field>
</v-col>

method: {
  handleChange(item) {
    console.log(`${item} was changed`)
  }
}

报错:

“[Vue warn]: Property or method ‘handleChange’ is not defined on the instance but referenced during render…

解决

you have to use

methods: {
    handleChange(item) {
       console.log(`${item} was changed`)
     }
}
喜欢 (4)

您必须 登录 才能发表评论!