weixin_小白369
2022-06-17 17:48
采纳率: 0%
浏览 820

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)

4条回答 默认 最新

相关推荐 更多相似问题