todoList是json格式
应该是不见得能识别你的 ${todoList}
你可以在 created 里面或者mounted里面
用this.todoList = ${todoList}
试一下吧
el-table-column 需要绑定一个label属性作为 每列的显示字段索引
<el-table :data="tableData" stripe style="width: 100%" class="box-table">
<el-table-column type="index" width="50"></el-table-column>
<el-table-column v-for="(item,key,val, index) in tableData[0]" :key="index">
<template slot="header">{{key}}</template>
<template slot-scope="scope">{{tableData[scope.$index][key]}}</template>
</el-table-column>
</el-table>
elementui中定义的todoList数据需要为数组,看题主发的数据是json,数组在data节点下,改成这样才行
return {
todoList:(${todoList}).data////获取json对象下的data数组
}
你在created(){console.log(this.todoList)}打印一下有没有数据
直接${todoList}是把ArrayList直接toString了,出来的并不是js里的数组,在java代码中先把todoList转成json字符串以后再设置到Request中去
把引入vue.js的script标签放到页面head里面,因为页面的渲染是强依赖vue,不能等HTML渲染完了再加载vue啊。
解决方案:
解决方法:
本来只需要用到对象res[i]中的两个属性,就单独赋值了,但是这样不显示;改为直接给最外层对象rule_data赋值,可以显示。
本来只需要用到对象res[i]中的两个属性,就单独赋值了,但是这样不显示;改为直接给最外层对象rule_data赋值