4 个回答

tableList在data里面是数组吗 在模板里面添加v-if="tableList.length"试试

返回的数组里面有name?你是如何使用这个name的?

 <el-table-column prop="name" label="图片" width="120">
    <template slot-scope="scope">
        <div>{{scope.row.xxx.name}}</div>
    </template>
 </el-table-column>

如果有类似上面的代码请修改为:

 <el-table-column prop="name" label="图片" width="120">
    <template slot-scope="scope">
        <div>{{scope.row.xxx&&scope.row.xxx.name}}</div>
    </template>
 </el-table-column>

做个临界值兼容吧,返回的数据里有些字段本应该是对象类型的,但是返回了null或者其他

问题找到了,已经解决了谢谢大佬们

<el-table-column v-if="cameraColData[13].istrue" label="摄像机类型" width="100">

 <template slot-scope="scope">{{ getCameraType(scope.row.cameraType) }}</template>

 </el-table-column>
  因为后台传入一个code :0 name:""
 cameraTypeList: [

 { name: "监控型机枪", code: 1 },

 { name: "监控型球机", code: 2 },

 { name: "全景型", code: 3 },

 { name: "抓拍机", code: 4 }

 ],
 
 
 
  getCameraType(type){

 var typeName

 for(var i in this.cameraTypeList){

 if(this.cameraTypeList[i].code+''==type+''){

 typeName=this.cameraTypeList[i].name

 }

 }

 return typeName ? typeName : ''

 },
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题