关于vue中的:data和scope.row
·
第一次项目遇到的问题
一、关于vue的几个疑惑
<el-table :data="fromList" stripe style="width: 100%">
<el-table-column prop="username" label="姓名" width="180"></el-table-column>
<el-table-column prop="password" label="密码" width="180"> </el-table-column>
<el-table-column label="适用性别" align="center">
<template slot-scope="scope">
<span>{{ scope.row.sex == '0' ? '不限' : scope.row.sex == '1' ? '男' : '女'}}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑 </el-button>
<el-button size="mini" type="danger" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table>
1、:data=“userList”
前面有:冒号,说明后面跟着是变量或者表达式,没有冒号代表后面的字符串
data:绑定表单的数据数组,里面存放每一个数据对象
2、slot-scope=“scope”
作用域插槽(待补充,)
3、scope.row
scope.row表示那行数据对象
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)