shijiplus-web-plugin 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -4
- package/src/App.vue +3 -1
- package/src/components/plus-comp/index.js +15 -0
- package/src/components/plus-comp/permission-component/permission-component.vue +78 -0
- package/src/components/plus-comp/plus-card/plus-card.vue +21 -0
- package/src/components/plus-comp/plus-city-cascader/plus-city-cascader.vue +108 -0
- package/src/components/plus-comp/plus-common-header/plus-common-header.vue +58 -0
- package/src/components/plus-comp/plus-count-down/plus-count-down.vue +51 -0
- package/src/components/plus-comp/plus-drawer/plus-drawer.vue +116 -0
- package/src/components/plus-comp/plus-form/plus-form.vue +149 -0
- package/src/components/plus-comp/plus-icon/plus-icon.vue +91 -0
- package/src/components/plus-comp/plus-modal/plus-modal.vue +281 -0
- package/src/components/plus-comp/plus-poptip/plus-poptip.vue +42 -0
- package/src/components/plus-comp/plus-qr-code/plus-qr-code.vue +110 -0
- package/src/components/plus-comp/plus-remote-selector/plus-remote-selector.vue +126 -0
- package/src/components/plus-comp/plus-scrollview/plus-scrollview.vue +58 -0
- package/src/components/plus-comp/plus-select/plus-select.vue +118 -0
- package/src/components/plus-comp/plus-table/export-mixin.js +78 -0
- package/src/components/plus-comp/plus-table/plus-circle-progress-modal.vue +54 -0
- package/src/components/plus-comp/plus-table/plus-table.vue +568 -0
- package/src/components/plus-comp/plus-tabs/plus-tabs.vue +76 -0
- package/src/directive/index.js +2 -0
- package/src/directive/module/authAccess.js +2 -2
- package/src/extentionPlugin/index.js +5 -5
- package/src/extentionPlugin/string.js +30 -1
- package/src/libs/excel.js +203 -0
- package/src/libs/util.js +184 -0
- package/src/main.js +2 -0
|
@@ -2,10 +2,34 @@ const install = (vue, opts = {}) => {
|
|
|
2
2
|
vue.prototype.$trim = trim
|
|
3
3
|
vue.prototype.$trimStart = trimStart
|
|
4
4
|
vue.prototype.$trimEnd = trimEnd
|
|
5
|
+
vue.prototype.$formatterBankCard = formatterBankCard
|
|
6
|
+
vue.prototype.$formatterPhoneNo = formatterPhoneNo
|
|
5
7
|
vue.prototype.$formtterCityName = formtterCityName
|
|
6
8
|
vue.prototype.$parseUrl = parseUrl
|
|
7
9
|
vue.prototype.$beautyNum = beautyNum
|
|
8
|
-
vue.prototype.$
|
|
10
|
+
vue.prototype.$numberToChinese = function (num) {
|
|
11
|
+
const chineseNumArr = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九']
|
|
12
|
+
const chineseUnitArr = ['', '十', '百', '千', '万', '亿']
|
|
13
|
+
let numArr = String(num).split('')
|
|
14
|
+
let numIndex = numArr.length - 1
|
|
15
|
+
let unitIndex = 0
|
|
16
|
+
let result = []
|
|
17
|
+
while (numIndex >= 0) {
|
|
18
|
+
const num = parseInt(numArr[numIndex])
|
|
19
|
+
let unitStr = num ? chineseUnitArr[unitIndex] : ''
|
|
20
|
+
let numStr = unitIndex == 0 && num == 0 ? '' : chineseNumArr[num]
|
|
21
|
+
let chinese = ''
|
|
22
|
+
if (unitIndex == 1 && numIndex == 0) {
|
|
23
|
+
chinese += (num > 1 ? numStr : '') + unitStr
|
|
24
|
+
} else {
|
|
25
|
+
chinese += numStr + unitStr
|
|
26
|
+
}
|
|
27
|
+
result[numIndex] = chinese
|
|
28
|
+
numIndex--
|
|
29
|
+
unitIndex++
|
|
30
|
+
}
|
|
31
|
+
return result.join('')
|
|
32
|
+
}
|
|
9
33
|
}
|
|
10
34
|
|
|
11
35
|
function formtterCityName(proName, cityName) {
|
|
@@ -16,6 +40,11 @@ function formtterCityName(proName, cityName) {
|
|
|
16
40
|
return `${proName}/${cityName}`
|
|
17
41
|
}
|
|
18
42
|
|
|
43
|
+
// 格式化银行卡号
|
|
44
|
+
function formatterBankCard(oriStr) {
|
|
45
|
+
var reg = /^(\d{4})\d+(\d{4})$/
|
|
46
|
+
return oriStr.replace(reg, '$1 **** **** $2')
|
|
47
|
+
}
|
|
19
48
|
// 格式化手机号
|
|
20
49
|
function formatterPhoneNo(oriStr) {
|
|
21
50
|
var reg = /^(\d{3})\d+(\d{4})$/
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import XLSX from 'xlsx';
|
|
3
|
+
|
|
4
|
+
function auto_width(ws, data) {
|
|
5
|
+
/*set worksheet max width per col*/
|
|
6
|
+
const colWidth = data.map(row => row.map(val => {
|
|
7
|
+
/*if null/undefined*/
|
|
8
|
+
if (val == null) {
|
|
9
|
+
return { 'wch': 10 };
|
|
10
|
+
}
|
|
11
|
+
/*if chinese*/
|
|
12
|
+
else if (val.toString().charCodeAt(0) > 255) {
|
|
13
|
+
return { 'wch': val.toString().length * 2 };
|
|
14
|
+
} else {
|
|
15
|
+
return { 'wch': val.toString().length };
|
|
16
|
+
}
|
|
17
|
+
}))
|
|
18
|
+
/*start in the first row*/
|
|
19
|
+
let result = colWidth[0];
|
|
20
|
+
for (let i = 1; i < colWidth.length; i++) {
|
|
21
|
+
for (let j = 0; j < colWidth[i].length; j++) {
|
|
22
|
+
if (result[j]['wch'] < colWidth[i][j]['wch']) {
|
|
23
|
+
result[j]['wch'] = colWidth[i][j]['wch'];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
ws['!cols'] = result;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function json_to_array(key, jsonData) {
|
|
31
|
+
return jsonData.map(v => key.map(j => { return v[j] }));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// fix data,return string
|
|
35
|
+
function fixdata(data) {
|
|
36
|
+
let o = ''
|
|
37
|
+
let l = 0
|
|
38
|
+
const w = 10240
|
|
39
|
+
for (; l < data.byteLength / w; ++l) o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w, l * w + w)))
|
|
40
|
+
o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w)))
|
|
41
|
+
return o
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// get head from excel file,return array
|
|
45
|
+
function get_header_row(sheet) {
|
|
46
|
+
const headers = []
|
|
47
|
+
const range = XLSX.utils.decode_range(sheet['!ref'])
|
|
48
|
+
let C
|
|
49
|
+
const R = range.s.r /* start in the first row */
|
|
50
|
+
for (C = range.s.c; C <= range.e.c; ++C) { /* walk every column in the range */
|
|
51
|
+
var cell = sheet[XLSX.utils.encode_cell({ c: C, r: R })] /* find the cell in the first row */
|
|
52
|
+
var hdr = 'UNKNOWN ' + C // <-- replace with your desired default
|
|
53
|
+
if (cell && cell.t) hdr = XLSX.utils.format_cell(cell)
|
|
54
|
+
headers.push(hdr)
|
|
55
|
+
}
|
|
56
|
+
return headers
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const export_table_to_excel = (id, filename) => {
|
|
60
|
+
const table = document.getElementById(id);
|
|
61
|
+
const wb = XLSX.utils.table_to_book(table);
|
|
62
|
+
XLSX.writeFile(wb, filename);
|
|
63
|
+
|
|
64
|
+
/* the second way */
|
|
65
|
+
// const table = document.getElementById(id);
|
|
66
|
+
// const wb = XLSX.utils.book_new();
|
|
67
|
+
// const ws = XLSX.utils.table_to_sheet(table);
|
|
68
|
+
// XLSX.utils.book_append_sheet(wb, ws, filename);
|
|
69
|
+
// XLSX.writeFile(wb, filename);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const export_json_to_excel = ({ data, key, title, filename, autoWidth }) => {
|
|
73
|
+
const wb = XLSX.utils.book_new();
|
|
74
|
+
data.unshift(title);
|
|
75
|
+
const ws = XLSX.utils.json_to_sheet(data, { header: key, skipHeader: true });
|
|
76
|
+
if (autoWidth) {
|
|
77
|
+
const arr = json_to_array(key, data);
|
|
78
|
+
auto_width(ws, arr);
|
|
79
|
+
}
|
|
80
|
+
const sheetName = filename.length > 31 ? 'sheet1' : filename
|
|
81
|
+
XLSX.utils.book_append_sheet(wb, ws, sheetName);
|
|
82
|
+
XLSX.writeFile(wb, filename + '.xlsx');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export const export_array_to_excel = ({ key, data, title, filename, autoWidth }) => {
|
|
86
|
+
const wb = XLSX.utils.book_new();
|
|
87
|
+
const arr = json_to_array(key, data);
|
|
88
|
+
arr.unshift(title);
|
|
89
|
+
const ws = XLSX.utils.aoa_to_sheet(arr);
|
|
90
|
+
if (autoWidth) {
|
|
91
|
+
auto_width(ws, arr);
|
|
92
|
+
}
|
|
93
|
+
XLSX.utils.book_append_sheet(wb, ws, filename);
|
|
94
|
+
XLSX.writeFile(wb, filename + '.xlsx');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export const read = (data, type) => {
|
|
98
|
+
/* if type == 'base64' must fix data first */
|
|
99
|
+
// const fixedData = fixdata(data)
|
|
100
|
+
// const workbook = XLSX.read(btoa(fixedData), { type: 'base64' })
|
|
101
|
+
const workbook = XLSX.read(data, { type: type });
|
|
102
|
+
const firstSheetName = workbook.SheetNames[0];
|
|
103
|
+
const worksheet = workbook.Sheets[firstSheetName];
|
|
104
|
+
const header = get_header_row(worksheet);
|
|
105
|
+
const results = XLSX.utils.sheet_to_json(worksheet);
|
|
106
|
+
return { header, results };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export const export_json_to_excel_buffer = ({ data, key, title, filename, autoWidth }) => {
|
|
110
|
+
const wb = XLSX.utils.book_new();
|
|
111
|
+
data.unshift(title);
|
|
112
|
+
const ws = XLSX.utils.json_to_sheet(data, { header: key, skipHeader: true });
|
|
113
|
+
if (autoWidth) {
|
|
114
|
+
const arr = json_to_array(key, data);
|
|
115
|
+
auto_width(ws, arr);
|
|
116
|
+
}
|
|
117
|
+
XLSX.utils.book_append_sheet(wb, ws, filename);
|
|
118
|
+
XLSX.writeFile(wb, filename + '.xlsx');
|
|
119
|
+
|
|
120
|
+
return XLSX.write(wb, { type: 'array', bookType: 'xlsx' });
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export const exportJsonToExcelBlob = ({ data, key, title, filename, autoWidth }) => {
|
|
124
|
+
const wb = XLSX.utils.book_new();
|
|
125
|
+
data.unshift(title);
|
|
126
|
+
const ws = XLSX.utils.json_to_sheet(data, { header: key, skipHeader: true });
|
|
127
|
+
if (autoWidth) {
|
|
128
|
+
const arr = json_to_array(key, data);
|
|
129
|
+
auto_width(ws, arr);
|
|
130
|
+
}
|
|
131
|
+
XLSX.utils.book_append_sheet(wb, ws, filename);
|
|
132
|
+
const buffer = XLSX.write(wb, { type: 'array', bookType: 'xlsx' });
|
|
133
|
+
return new Blob([buffer], { type: 'application/octet-stream' })
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export const exportAugmentedExcel = (data, keys, opts = {}) => {
|
|
137
|
+
const defaultOptions = { cellContents: [], autoWidth: false, fileName: '表格' }
|
|
138
|
+
const {
|
|
139
|
+
cellContents, autoWidth, fileName
|
|
140
|
+
} = Object.assign({}, defaultOptions, opts)
|
|
141
|
+
const wb = XLSX.utils.book_new()
|
|
142
|
+
let originIndex = 1
|
|
143
|
+
if (cellContents) {
|
|
144
|
+
originIndex = cellContents.length + 1
|
|
145
|
+
} else {
|
|
146
|
+
cellContents = []
|
|
147
|
+
}
|
|
148
|
+
let ws = XLSX.utils.json_to_sheet(data || [], { header: keys || [], origin: `A${originIndex}` })
|
|
149
|
+
const { e, s } = XLSX.utils.decode_range(ws["!ref"])
|
|
150
|
+
const newEnd = { c: e.c, r: e.r }
|
|
151
|
+
cellContents.forEach((rItem, rIndex) => {
|
|
152
|
+
rItem.forEach((cItem, cIndex) => {
|
|
153
|
+
const cellKey = XLSX.utils.encode_cell({ c: cIndex, r: rIndex })
|
|
154
|
+
ws[cellKey] = {
|
|
155
|
+
t: 's',
|
|
156
|
+
v: cItem
|
|
157
|
+
}
|
|
158
|
+
if (cIndex > newEnd.c) {
|
|
159
|
+
newEnd.c = cIndex
|
|
160
|
+
}
|
|
161
|
+
})
|
|
162
|
+
})
|
|
163
|
+
if (e.c < newEnd.c) {
|
|
164
|
+
ws["!ref"] = XLSX.utils.encode_range(s, newEnd)
|
|
165
|
+
}
|
|
166
|
+
if (autoWidth) {
|
|
167
|
+
let cols = []
|
|
168
|
+
for (let cIdx = 0; cIdx <= newEnd.c; cIdx++) {
|
|
169
|
+
let wch = 10
|
|
170
|
+
for (let rIdx = 0; rIdx <= newEnd.r; rIdx++) {
|
|
171
|
+
let formAddress = XLSX.utils.encode_cell({ c: cIdx, r: rIdx })
|
|
172
|
+
if (ws[formAddress]) {
|
|
173
|
+
const val = ws[formAddress].v || ''
|
|
174
|
+
let nWch = wch
|
|
175
|
+
if (val.toString().charCodeAt(0) > 255) {
|
|
176
|
+
nWch = val.toString().length * 2
|
|
177
|
+
} else {
|
|
178
|
+
nWch = val.toString().length
|
|
179
|
+
}
|
|
180
|
+
if (nWch > wch) {
|
|
181
|
+
wch = nWch
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (!cols[cIdx]) {
|
|
186
|
+
cols[cIdx] = {}
|
|
187
|
+
}
|
|
188
|
+
cols[cIdx]['wch'] = wch
|
|
189
|
+
}
|
|
190
|
+
ws['!cols'] = cols
|
|
191
|
+
}
|
|
192
|
+
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
|
193
|
+
XLSX.writeFile(wb, (fileName || '表格') + '.xlsx');
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export default {
|
|
197
|
+
export_table_to_excel,
|
|
198
|
+
export_array_to_excel,
|
|
199
|
+
export_json_to_excel,
|
|
200
|
+
read,
|
|
201
|
+
export_json_to_excel_buffer,
|
|
202
|
+
exportAugmentedExcel
|
|
203
|
+
}
|
package/src/libs/util.js
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { export_json_to_excel as exportJsonToExcel, exportJsonToExcelBlob } from './excel'
|
|
2
|
+
|
|
3
|
+
export const exportTableExcelBlob = (tableData, tableColumn, fileName) => {
|
|
4
|
+
return new Promise((resolve, reject) => {
|
|
5
|
+
try {
|
|
6
|
+
if (!tableData) {
|
|
7
|
+
tableData = []
|
|
8
|
+
}
|
|
9
|
+
const excelData = tableData.map((dataItem, index) => {
|
|
10
|
+
let newDataItem = {}
|
|
11
|
+
tableColumn.forEach((cItem) => {
|
|
12
|
+
if (cItem.excel) {
|
|
13
|
+
if (cItem.exportValue) {
|
|
14
|
+
newDataItem[cItem.title] = cItem.exportValue(dataItem)
|
|
15
|
+
} else {
|
|
16
|
+
newDataItem[cItem.title] = dataItem[cItem.key]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
return newDataItem
|
|
21
|
+
})
|
|
22
|
+
var title = {}
|
|
23
|
+
tableColumn.forEach((item) => {
|
|
24
|
+
// 是否允许导出
|
|
25
|
+
if (item.excel) {
|
|
26
|
+
title[item.title] = item.title
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
resolve(exportJsonToExcelBlob({
|
|
30
|
+
data: excelData,
|
|
31
|
+
key: [],
|
|
32
|
+
title: title,
|
|
33
|
+
filename: fileName,
|
|
34
|
+
autoWidth: true
|
|
35
|
+
}))
|
|
36
|
+
} catch (error) {
|
|
37
|
+
reject(error)
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const exportTableExcel = (tableData, tableColumn, fileName) => {
|
|
43
|
+
return new Promise((resolve, reject) => {
|
|
44
|
+
try {
|
|
45
|
+
if (!tableData) {
|
|
46
|
+
tableData = []
|
|
47
|
+
}
|
|
48
|
+
const excelData = tableData.map((dataItem, index) => {
|
|
49
|
+
let newDataItem = {}
|
|
50
|
+
tableColumn.forEach((cItem) => {
|
|
51
|
+
if (cItem.excel) {
|
|
52
|
+
if (cItem.exportValue) {
|
|
53
|
+
newDataItem[cItem.title] = cItem.exportValue(dataItem)
|
|
54
|
+
} else {
|
|
55
|
+
newDataItem[cItem.title] = dataItem[cItem.key]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
return newDataItem
|
|
60
|
+
})
|
|
61
|
+
var title = {}
|
|
62
|
+
tableColumn.forEach((item) => {
|
|
63
|
+
// 是否允许导出
|
|
64
|
+
if (item.excel) {
|
|
65
|
+
title[item.title] = item.title
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
exportJsonToExcel({
|
|
69
|
+
data: excelData,
|
|
70
|
+
key: [],
|
|
71
|
+
title: title,
|
|
72
|
+
filename: fileName,
|
|
73
|
+
autoWidth: true
|
|
74
|
+
})
|
|
75
|
+
resolve(true)
|
|
76
|
+
} catch (error) {
|
|
77
|
+
reject(error)
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const timers = []
|
|
83
|
+
|
|
84
|
+
export const debounce = (fn, scheduleMs, immediate = false) => {
|
|
85
|
+
return new Promise((resolve, reject) => {
|
|
86
|
+
if (fn instanceof Promise) {
|
|
87
|
+
return reject(new Error('Promise 不支持取消故无法debounce'))
|
|
88
|
+
}
|
|
89
|
+
const execFn = () => {
|
|
90
|
+
const result = fn.call()
|
|
91
|
+
if (result instanceof Promise) {
|
|
92
|
+
result.then((resp) => {
|
|
93
|
+
resolve(resp)
|
|
94
|
+
}).catch(err => {
|
|
95
|
+
reject(err)
|
|
96
|
+
})
|
|
97
|
+
} else if (!result) {
|
|
98
|
+
resolve(result)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (timers[fn]) {
|
|
102
|
+
clearTimeout(timers[fn])
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (immediate) {
|
|
106
|
+
if (timers[fn] == null) {
|
|
107
|
+
execFn()
|
|
108
|
+
}
|
|
109
|
+
timers[fn] = setTimeout(() => {
|
|
110
|
+
timers[fn] = null
|
|
111
|
+
}, scheduleMs)
|
|
112
|
+
} else {
|
|
113
|
+
timers[fn] = setTimeout(() => {
|
|
114
|
+
execFn()
|
|
115
|
+
timers[fn] = null
|
|
116
|
+
}, scheduleMs)
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const trailingCharacters = (str, replaceStr, options = { width: 0, fontSize: 1, lines: 0 }) => {
|
|
122
|
+
const { width, fontSize, lines } = options
|
|
123
|
+
const maxCharacters = Math.floor(width / fontSize) * lines
|
|
124
|
+
let result = str
|
|
125
|
+
if (width > 0 && result.length > maxCharacters) {
|
|
126
|
+
const rLength = replaceStr.length
|
|
127
|
+
result = result
|
|
128
|
+
.substr(0, maxCharacters)
|
|
129
|
+
.substr(0, maxCharacters - rLength) + replaceStr
|
|
130
|
+
}
|
|
131
|
+
return result
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const throttleExecTimes = []
|
|
135
|
+
const throttleExecTrailTimer = []
|
|
136
|
+
|
|
137
|
+
export const throttle = (fn, interval, options = { leading: true, trailing: true }) => {
|
|
138
|
+
const defaultConfig = { leading: true, trailing: true }
|
|
139
|
+
const { leading, trailing } = Object.assign(Object.assign({}, defaultConfig), options)
|
|
140
|
+
return new Promise((resolve, reject) => {
|
|
141
|
+
let nowTime = new Date().getTime()
|
|
142
|
+
let execTime = throttleExecTimes[fn] || (leading ? 0 : nowTime + interval)
|
|
143
|
+
let execTimer = throttleExecTrailTimer[fn]
|
|
144
|
+
const execFun = () => {
|
|
145
|
+
if (execTimer) {
|
|
146
|
+
clearTimeout(execTimer)
|
|
147
|
+
throttleExecTrailTimer[fn] = null
|
|
148
|
+
}
|
|
149
|
+
if (fn instanceof Promise) {
|
|
150
|
+
fn.then((resp) => {
|
|
151
|
+
resolve(resp)
|
|
152
|
+
}).catch(err => {
|
|
153
|
+
reject(err)
|
|
154
|
+
})
|
|
155
|
+
} else {
|
|
156
|
+
const result = fn.call()
|
|
157
|
+
if (result instanceof Promise) {
|
|
158
|
+
result.then((resp) => {
|
|
159
|
+
resolve(resp)
|
|
160
|
+
}).catch(err => {
|
|
161
|
+
reject(err)
|
|
162
|
+
})
|
|
163
|
+
} else if (!result) {
|
|
164
|
+
resolve(result)
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (execTime <= nowTime) {
|
|
170
|
+
console.log('---common----')
|
|
171
|
+
execFun()
|
|
172
|
+
throttleExecTimes[fn] = nowTime + interval
|
|
173
|
+
} else if (trailing) {
|
|
174
|
+
if (execTimer) {
|
|
175
|
+
clearTimeout(execTimer)
|
|
176
|
+
throttleExecTrailTimer[fn] = null
|
|
177
|
+
}
|
|
178
|
+
throttleExecTrailTimer[fn] = setTimeout(() => {
|
|
179
|
+
console.log('---trailing----')
|
|
180
|
+
execFun()
|
|
181
|
+
}, interval)
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
}
|
package/src/main.js
CHANGED
|
@@ -5,9 +5,11 @@ import './index.less'
|
|
|
5
5
|
import i18n from '@/locale'
|
|
6
6
|
import ExtentionPlugin from './extentionPlugin'
|
|
7
7
|
import importDirective from './directive'
|
|
8
|
+
import PlusComp from './components/plus-comp'
|
|
8
9
|
|
|
9
10
|
Vue.config.productionTip = false
|
|
10
11
|
|
|
12
|
+
Vue.use(PlusComp)
|
|
11
13
|
/**
|
|
12
14
|
* 注册指令
|
|
13
15
|
*/
|