1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
| /*
| * @Descripttion: Vue过滤器
| * @Author: TM丶
| * @LastEditors: 小明丶
| * @Date: 2019-04-05 11:32:33
| * @LastEditTime: 2020-10-10 14:52:54
| */
| import dataformat from "./dateformat";
|
| /**
| * @Descripttion: 格式化电话号码
| * @param {tel} 电话号码
| * @return: 13388327924 >>> 133****7924
| */
| export function formatPhone(tel) {
| return tel.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
| }
|
|
| let list = [
| {name:'timeformat',fn:dataformat.format},
| // {name:'phoneformat',fn:formatPhone},
| ];
|
| export default {
| install(Vue,opt){
| list.forEach(item=>{
| Vue.filter(item.name,item.fn);
| })
| }
| }
|
|