小白何时能吃老白 2022-06-17 17:48 采纳率: 0%
浏览 5019

vue项目中遇到Cannot read properties of undefined (reading 'length')

在浏览器F12下,发现如下报错:
  Vue warn]: Error in v-on handler (Promise/async): "TypeError: Cannot read properties of undefined (reading 'length')"
  TypeError: Cannot read properties of undefined (reading 'length')
这是代码
    //改变状态
    async deleteUser1() {
      for (let i = 0; i < this.casesId[i].length; i++) {
        console.log("11111", this.casesId[i].length);
        let parmars = {
          articleId: this.casesId[i],
          casesStat: 10,
        };
        let res = await article.updateart(parmars);
        console.log("22222", res);
      }
      this.getCaseList();
    },

<el-table-column
              prop="casesStat"
              v-model="deleteUser1"
              label="状态"
              width="80"
            >
              <template slot-scope="{ row }">
                {{ row.casesStat | statDate }}
              </template>
            </el-table-column>


          <el-button size="mini" type="primary" @click="deleteUser1()"
            >屏蔽</el-button

这个报错的位置,实在是不知道怎么改啊

有没有老前辈,搭救一下

vue.esm.js?a026:628 [Vue warn]: Error in v-on handler (Promise/async): "TypeError: Cannot read properties of undefined (reading 'length')"

found in

---> <ElButton> at packages/button/src/button.vue
       <Anonymous>
         <ElMain> at packages/main/src/main.vue
           <Index> at src/views/Index.vue
             <App> at src/App.vue
               <Root>

vue.esm.js?a026:1906 TypeError: Cannot read properties of undefined (reading 'length')
    at _callee3$ (Caselist.vue?8692:238:1)
    at tryCatch (runtime.js?96cf:63:1)
    at Generator.invoke [as _invoke] (runtime.js?96cf:294:1)
    at Generator.eval [as next] (runtime.js?96cf:119:1)
    at asyncGeneratorStep (asyncToGenerator.js?1da1:3:1)
    at _next (asyncToGenerator.js?1da1:25:1)
    at eval (asyncToGenerator.js?1da1:32:1)
    at new Promise (<anonymous>)
    at eval (asyncToGenerator.js?1da1:21:1)
    at VueComponent.deleteUser1 (Caselist.vue?8692:238:1)

  • 写回答

3条回答 默认 最新

  • 关注

    this.casesId[i]打印下看这里的格式

    评论

报告相同问题?

问题事件

  • 创建了问题 6月17日

悬赏问题

  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退