<el-table :data="tableData" style="width: 60%;margin-top:10px;">
<el-table-column prop="date" label="选择" width="180">
<template slot-scope="scope">
<el-radio v-model="templateradio" :label="scope.$index+null" @change.native="getTemplateRow(scope.$index,scope.row)"></el-radio>
</template>
</el-table-column>
<el-table-column prop="name" label="角色编号" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.roleCode }}</span>
</template>
</el-table-column>
<el-table-column prop="address" label="角色名称">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.roleName }}</span>
</template>
</el-table-column>
<el-table-column prop="address" label="创建人">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.createdBy }}</span>
</template>
</el-table-column>
<el-table-column prop="address" label="状态(启用/禁用)">
<template slot-scope="scope">
<el-checkbox></el-checkbox>
<span style="margin-left: 10px">{{ scope.row.isStart }}</span>
</template>
</el-table-column>
<el-table-column prop="address" label="最后修改时间">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.createDate }}</span>
</template>
</el-table-column>
</el-table>
js代码 构造函数
created(){
console.log(1);
let _this=this;
//Vue对象创建完毕后的钩子函数
axios.post("/SL/GetRole",null).then(function(res){
//请求成功的处理函数
_this.$data.tableData=res.data;
}).catch(function(res){
//请求失败的处理函数
});
}
换了个方式
<el-table-column
prop="address"
label="状态(启用/禁用)">
<template slot-scope="scope">
<el-checkbox :true-label="1" :false-label="0" v-model="scope.row.isStart"></el-checkbox>
</template>
</el-table-column>
根据获取数据库中的值,是否是true-lable(选中时的值),如果是则选中,如果不是则不选择
谢谢,已解决