vue+element 根据状态,显示不同的操作按钮
vue+element 根据状态,显示不同的操作按钮
·
想要的效果:
话不多说上代码:
<!-- table表格 -->
<el-table :data="tableData" border style="width: 100%" v-loading="loading">
<el-table-column type="selection" width="55" align="center">
</el-table-column>
<el-table-column fixed prop="pumpName" label="泵站名称" width="150" align="center"></el-table-column>
<el-table-column prop="pointName" label="点位名称"></el-table-column>
<el-table-column prop="id" label="id"></el-table-column>
<el-table-column prop="timeHorizon" label="视频时间范围" width="200"></el-table-column>
<el-table-column prop="createTime" label="下载时间"></el-table-column>
<el-table-column prop="taskAchievement" label="完成情况">
<template slot-scope="scope" style="text-align: left">
<div v-if="scope.row.taskAchievement == '1'">下载中</div>
<div v-if="scope.row.taskAchievement == '2'">已完成</div>
<div v-if="scope.row.taskAchievement == '3'">下载失败</div>
</template>
</el-table-column>
<el-table-column prop="path" label="存放路径">
<el-tage slot-scope="scope" @click="handleCopyLink(scope.row)">
{{ scope.row.path }}
</el-tage>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button class="table-button" size="small" @click="handleEdit(scope.$index, scope.row)">
<i class="fa fa-play-circle-o fa-1x" aria-hidden="true"></i>
<span v-if="scope.row.taskAchievement == '1'">下载中 </span>
<span v-if="scope.row.taskAchievement == '2'">播放录像</span>
<span v-if="scope.row.taskAchievement == '3'">重新下载</span>
</el-button>
<el-button class="table-button" size="small" @click.native.prevent="deleteRow(scope.$index, scope.row)">
<i class="fa fa-remove" aria-hidden="true"></i>
<span>删除</span>
</el-button>
</template>
</el-table-column>
</el-table>
重点代码:
总结:通过 v-if指令 决定按钮显示的不同
更多推荐
已为社区贡献2条内容
所有评论(0)