vue-el-table-api
v1.0.4
Published
基于element或常用api封装
Downloads
13
Readme
VUE elementUI table 常用API
安装:
npm i vue-el-table-api
由于部分方法使用到axios
请安装axios
npm install axios
使用:
import { utility, requestUtility } from 'vue-el-table-api'
例子:utility.checkAll(arr,['id']).id
API方法:
utility对象:
checkAll 全选后数据提取
// 封装elementUi table全选后数据提取
/*
params 需要操作的数组
keyArr 需要转换的字段 ['id','memberNumber']
symbol 需要切换的字符 默认为,号
使用 checkAll(arr,['id','memberNumber']).id 结果1,2,3,4
*/
使用例子:let obj = utility.checkAll(arr,['id','name'],',')
obj.id 结果'1,2,3,4'
obj.name 结果'陈,王,李,林'
monthPackaging 自定义时间选择,一般用于elementUI月份选择
/*
status:0或1
0代表当前时间的前面
1代表当前时间的后面
day: 7 默认为30
例子:monthPackaging(0, 7) 意思为7天前
例子:monthPackaging(1, 7) 意思为7天后
*/
kilobitTransition 单个值千位符转换
/*
level:为数据值 如30000或'300000'
status:1 1代表是带两位小数点,其它即是不带小数点
例子:kilobitTransition(30000, 1) 结果¥30,000.00
*/
multiKilobitTransition 转换数据中有多个值的,如1000,2000
/*
level:为数据值 如1000,2000
例子:multiKilobitTransition('1000,2000') 结果¥1,000.00,¥2,000.00
*/
infoDesensitization 信息脱敏
/*
支持数据:身份证、手机号码、银行卡号
例子:infoDesensitization('15360458815') 结果153****8815
*/
持续更新...
requestUtility对象:
batchPostExport 数据批量导出 - post
/*
参数:
params:{
url:'', //导出请求链接
obj:{}, //导出请求参数
fileName: '会员列表' //导出文件名
}
suffix:文件后缀 默认为'xlsx'
例子:batchPostExport(params,'xls')
*/
如需帮助 vx:czl630964