vue-filter-eric
1.0.5 • Public • Published vue-filter-eric
安装
npm install --save vue-filter-eric
全局引入
import Vue from "vue";
import filters from "vue-filter-eric";
Vue.use(filters);
按需引入
import { thousand } from "vue-filter-eric";
Vue.filter("thousand", thousand);
说明
Date
Name |
Params |
Default |
Description |
dateFormat |
_format |
String | 'YYYY-MM-DD' |
日期格式化 |
Math
Name |
Params |
Default |
Description |
abs |
- |
- |
绝对值 |
cos |
- |
- |
余弦 |
acos |
- |
- |
反余弦值 |
asin |
- |
- |
反正弦值 |
atan |
- |
- |
以介于 -PI/2 与 PI/2 弧度之间的数值来返回 x 的反正切值 |
ceil |
- |
- |
上舍入 |
Number
Name |
Params |
Default |
Description |
thousand |
_symbol |
String | ' ' |
千位分隔 |
percent |
_decimals |
Number | 2 |
百分比,保留x位有效小数 |
toFixed |
_decimals |
Number | 2 |
四舍五入,保留x位有效小数 |
Object
Name |
Params |
Default |
Description |
getLabelByValue |
list |
Array | [] |
在list中找到对应value的label值 |
label |
String | 'label' |
String
Name |
Params |
Default |
Description |
strReplace |
regArr |
Array | [] |
字符替换,隐藏手机号或者身份证号等
replaceStr('18819322663',[3,5,3],0) //188*****663
ecDo.replaceStr('asdasdasdaa',[3,5,3],1) //***asdas***
ecDo.replaceStr('1asd88465asdwqe3',[5],0)//*****8465asdwqe3
ecDo.replaceStr('1asd88465asdwqe3',[5],1,'+')//1asd88465as+++++
|
type |
Number | 0 |
replaceText |
String | '*' |
strFormat |
size |
Number | 3 |
格式化处理字符串,strFormat('1234asda567asd890',4,'-') //"1-234a-sda5-67as-d890" |
delimiter |
String | ',' |
Package Sidebar
Install
Weekly Downloads