当前位置:   article > 正文

报错:Property or method “item“ is not defined on the instance but referenced during render._property or method "item" is not defined on the in

property or method "item" is not defined on the instance but referenced duri

前言:目前在敲项目,遇到的报错问题~

报错原因:

Property or method "item" 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. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

found in

翻译报错:属性或方法“item”未在实例上定义,但在渲染期间被引用。通过初始化该属性,确保该属性是反应性的,无论是在数据选项中,还是对于基于类的组件。

简而言之,就是item未定义,但在渲染期间使用。 

错误代码/原代码:

 错误原因是识别了""双引号,里面应该写单引号

改完代码:

  1. <el-col :span="16">
  2. <div class="num">
  3. <el-card
  4. v-for="item in countData"
  5. :key="item.name"
  6. :body-style="{ display:'flex', padding: 0 }"
  7. >
  8. <i
  9. class="icon"
  10. :class="`el-icon-${item.icon}`"
  11. :style="{ background: item.color }"
  12. >
  13. </i>
  14. <div class="detail">
  15. <p class="num">¥{{ item.value }}</p>
  16. <p class="txt">{{ item.name }}</p>
  17. </div>
  18. </el-card>
  19. </div>
  20. </el-col>

 

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

闽ICP备14008679号