vue+elementUI table篇
1.table内容展示
<el-table stripe :key='tableKey' header-cell-class-name="bindonce" :data="tableList" v-loading="listLoading" element-loading-text="列表正在加载中" border fit highlight-current-row
style="width: 100%;" @selection-change="selectionChange">
<el-table-column align="center" type="selection" width="55px"></el-table-column> <el-table-column align="center" :label="'会员卡名称'" width="150" sortable prop="scope.row.name">
<template slot-scope="scope">
<span v-text="scope.row.name"></span>
</template>
</el-table-column> <el-table-column align="center" :label="'会员卡类型'" width="120" prop="scope.row.type"
:filters="[{text: '全部', value: 0},{text: '时效卡', value: 1}, {text: '次卡', value: 2}]"
:filter-method="filterType" filter-placement="bottom-end" :filter-multiple="false">
<template slot-scope="scope">
<span>{{scope.row.type === 1 ? '时效卡' : '次卡'}}</span>
</template>
</el-table-column> <el-table-column align="center" :label="'总时间/次数'" width="150" sortable prop="scope.row.times">
<template slot-scope="scope">
<span>{{ scope.row.type===1 ? scope.row.times + '天' : scope.row.times + '次'}}</span>
</template>
</el-table-column> <el-table-column align="center" :label="'价格(元)'" width="150" sortable prop="scope.row.price">
<template slot-scope="scope">
<span>{{scope.row.price}}</span>
</template>
</el-table-column> <el-table-column align="center" :label="'底价(元)'" width="150" sortable prop="scope.row.floor_price">
<template slot-scope="scope">
<span>{{scope.row.floor_price}}</span>
</template>
</el-table-column> <el-table-column align="center" :label="'APP状态'" width="150" sortable prop="scope.row.app_status">
<template slot-scope="scope">
<span>{{scope.row.app_status === 1? '下架':'上架'}}</span>
</template>
</el-table-column> <el-table-column align="center" :label="'SAAS状态'" width="150" sortable prop="scope.row.saas_status">
<template slot-scope="scope">
<span>{{scope.row.saas_status === 1? '下架' : '上架'}}</span>
</template>
</el-table-column> <el-table-column width="150px" align="center" :label="'会员卡图标'">
<template slot-scope="scope">
<span><img :src="scope.row.photo" @click="common.bigImg($event)" alt="icon" width="30" height="30" style="margin-left:50px;display: list-item;border-radius:50%;"></span>
</template>
</el-table-column> <el-table-column width="200px" align="center" label="创建时间<i class='el-icon-date'></i>" sortable prop="scope.row.created_at">
<template slot-scope="scope">
<span>{{scope.row.created_at}}</span>
</template>
</el-table-column> <el-table-column align="center" fixed="right" :label="$t('table.actions')" min-width="230" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="primary" plain
@click="handleEdit(scope.$index, scope.row)">编辑</el-button>
<el-dropdown trigger="click">
<el-button size="mini" type="danger" plain>删除</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="handleDelete(scope.$index, tableList)">确定</el-dropdown-item>
<el-dropdown-item>取消</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
2.编辑
handleEdit(index, row) {
this.subStatus = 'edit_' + index
this.formData = Object.assign({}, row)
this.DialogVisible = true
this.add_edit = true
this.$nextTick(() => {
this.$refs.imgbox.setImg(row.photo)
})
},
editsubmit() {
let self = this
this.$refs.formbox.validate(valid => {
if (valid) {
self.loading = true
editVipCard(self.formData).then(response => {
self.loading = false
self.DialogVisible = false
let index = self.subStatus.split('_')[1]
self.$set(self.tableList, index, response.data)
// this.getList()
})
} else {
console.log('error submit!!')
return false
}
})
},
3.删除
handleDelete(index, rows) {
deleteVipCard(rows[index].id).then(res => {
rows.splice(index, 1)
}).catch(() => {
this.common.Message('error', '删除失败!')
})
}
4.table中使用checkbox,判断选中状态
在table中加入@selection-change="selectionChange"
// 点击checkbox获得对应id
selectionChange(selection) {
this.groupOprate.ids = []
for (let i = 0; i < selection.length; i++) {
this.groupOprate.ids.push(selection[i].id)
}
console.log(this.groupOprate.ids)
},
vue+elementUI table篇的更多相关文章
- 关于【vue + element-ui Table的数据多选,多页选择数据回显,分页记录保存选中的数据】的优化
之前写的[vue + element-ui Table的数据多选,多页选择数据回显,分页记录保存选中的数据]这篇博客.功能虽然实现了相对应的功能.但是用起来很不爽.所以进行了优化. 备注:最近可能没时 ...
- Vue Element-ui table只展开一行
直接上代码了哈~ <template> <div class="app-content"> <div class="table_expand ...
- vue + element-ui Table的数据多选,多页选择数据回显,分页记录保存选中的数据。
业务的需要:我要对与会人员勾选,记录所选的与会人员,并且点击到别的页面上时也要记录所勾选的.第一次尝试,每次点击下一页数据都会清空.然后我就去element ui官网查看了api.实现如下: 在tab ...
- vue element-ui Table数据解除自动响应方法
在对列表Table进行数据编辑时,会存在table的增删改操作后,列表view也自动响应发生了变化,原因是赋值的数据是一个引用类型共享一个内存区域的.所以我们就不能直接连等复制,需要重新克隆一份新的数 ...
- vue elementui table 双击单元格实现编辑,聚焦,失去焦点,显示隐藏input和span
<el-table :data="tableData" class="tb-edit" style="width: 100%" ref ...
- vue elementui table 内按钮跳转页面
vue : <el-table-column label="操作" v-if="isColumOperate"> <template slot ...
- vue elementui table组件内容换行
解决方案 tableData = [ { "name": "domain111", "metric": [ "平均耗时" ...
- Vue + Element-ui实现后台管理系统(5)---封装一个Form表单组件和Table表格组件
封装一个Form表单组件和Table组件 有关后台管理系统之前写过四遍博客,看这篇之前最好先看下这四篇博客.另外这里只展示关键部分代码,项目代码放在github上: mall-manage-syste ...
- SpringBoot + Vue + ElementUI 实现后台管理系统模板 -- 后端篇(五): 数据表设计、使用 jwt、redis、sms 工具类完善注册登录逻辑
(1) 相关博文地址: SpringBoot + Vue + ElementUI 实现后台管理系统模板 -- 前端篇(一):搭建基本环境:https://www.cnblogs.com/l-y-h/p ...
随机推荐
- POJ 2785_4 Values whose Sum is 0
题意: A,B,C,D四组数中各取一个数,使这四个数相加为0,问有多少组取法? 分析: 四个数列有n4种取法,规模较大,但是可以将他们分成AB,CD两组,分别枚举,最后再合并. 代码: #includ ...
- Tomcat服务器调优
一,目标:优化tomcat来提高访问的并发能力. 服务器提供的内存,cpu,以及硬盘的性能对数据的处理起决定性作用. tomcat的3种运行模式 tomcat的运行模式有3种: 1. bio默认的模式 ...
- JAVA分布式架构
- Check ini style config tool
INI style config is like below [section] # comment key = value Sometimes we want to check the config ...
- springboot application.properties
verify if you have this items: @Bean public CommonsMultipartResolver multipartResolver() { CommonsMu ...
- 【Nginx】epoll及内核源码详解
内核源码: https://www.nowcoder.com/discuss/26226?type=0&order=0&pos=21&page=1 epoll流程: 首先调用e ...
- android仿qq空间、微信朋友圈图片展示
废话不多说,先上效果图 由于近期须要做朋友圈功能,所以在此记录一下,事实上非常多人不明确的一点应该是在图片的排列上面吧,不规则的排列,事实上非常easy的.就是一个GridView.然而你xml光光写 ...
- Pivotal Cloud Foundry安全原理解析
云计算相关的技术差点儿都对传统网络架构和安全规则产生一定的冲击.Pivotal Cloud Foundry(PCF)也不例外,去年8月为了说服专业安全组织允许PaaS部署方案,特意为他们深入讲了下PC ...
- 记录一次node中台转发表单上传文件到后台过程
首发掘金 记录一次node中台转发表单上传文件到后台过程 本篇跟掘金为同一个作者leung 公司几个项目都是三层架构模式即前台,中台(中间层),后台.前台微信端公众号使用vue框架,后台管理前端使 ...
- 我是怎样自学 Android 的?
1. Java知识储备 本知识点不做重点解说: 对于有基础的同学推荐看<Java编程思想>,巩固基础,查漏补全,了解并熟悉很多其它细节知识点. 对于没有基础的同学推荐看一本Java基础的书 ...