当前位置:   article > 正文

vue报错:Property or method "active" is not defined on the instance

property or method "active" is not defined on the instance but referenced du

vue.runtime.esm.js?0261:619 [Vue warn]: Property or method “active” is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.

这个报错是因为你在template里面或者在方法里面使用了 “active” ,但是在data里面没有定义。

<van-tabs v-model="active">
  <van-tab title="标签 1">内容 1</van-tab>
  <van-tab title="标签 2">内容 2</van-tab>
  <van-tab title="标签 3">内容 3</van-tab>
  <van-tab title="标签 4">内容 4</van-tab>
</van-tabs>
export default {
  data() {
    return {
      active: 2
    };
  }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

找到了是v-model绑定的active忘记在data里定义了

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/315791
推荐阅读
相关标签
  

闽ICP备14008679号