@netang/quasar 0.0.47 → 0.0.49
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/components/dialog/index.vue +10 -10
- package/components/dialog-table/index.vue +1 -1
- package/components/dragger/index.vue +2 -2
- package/components/drawer/index.vue +7 -7
- package/components/field-date/index.vue +35 -35
- package/components/field-table/index.vue +39 -41
- package/components/field-text/index.vue +2 -2
- package/components/field-tree/index.vue +19 -19
- package/components/input-number/index.vue +2 -2
- package/components/list-menu/index.vue +2 -2
- package/components/private/components/move-to-tree/index.vue +2 -2
- package/components/private/edit-power-data/index.vue +50 -50
- package/components/private/table-visible-columns-button/index.vue +2 -2
- package/components/render/index.vue +6 -6
- package/components/search/index.vue +2 -2
- package/components/search-item/index.vue +5 -5
- package/components/select/index.vue +2 -2
- package/components/splitter/index.vue +7 -7
- package/components/table/index.vue +5 -5
- package/components/table-splitter/index.vue +22 -11
- package/components/table-summary/index.vue +3 -3
- package/components/thumbnail/index.vue +6 -6
- package/components/uploader/index.vue +1 -1
- package/components/uploader-query/index.vue +25 -25
- package/components/value-format/index.vue +65 -38
- package/package.json +1 -1
- package/utils/$area.js +13 -13
- package/utils/$auth.js +6 -6
- package/utils/$dialog.js +3 -3
- package/utils/$form.js +2 -2
- package/utils/$power.js +124 -117
- package/utils/$rule.js +4 -4
- package/utils/$search.js +50 -50
- package/utils/$table.js +76 -76
- package/utils/$tree.js +43 -43
- package/utils/$uploader.js +47 -47
- package/utils/alert.js +1 -1
- package/utils/arr.js +2 -2
- package/utils/bus.js +1 -1
- package/utils/config.js +4 -4
- package/utils/confrim.js +1 -1
- package/utils/dict.js +5 -5
- package/utils/getData.js +9 -9
- package/utils/getFile.js +5 -5
- package/utils/getImage.js +12 -12
- package/utils/getTime.js +4 -4
- package/utils/http.js +20 -20
- package/utils/loading.js +1 -1
- package/utils/notify.js +1 -1
- package/utils/previewImage.js +2 -2
- package/utils/price.js +3 -3
- package/utils/timestamp.js +1 -1
- package/utils/toast.js +1 -1
- package/utils/uploader/qiniu.js +11 -11
- package/utils/useAuth.js +2 -2
- package/utils/useRouter.js +4 -4
- package/components/input-format/index.vue +0 -268
|
@@ -308,7 +308,7 @@ export default {
|
|
|
308
308
|
let rightDrawer = false
|
|
309
309
|
|
|
310
310
|
// 如果有插槽
|
|
311
|
-
if (
|
|
311
|
+
if ($n.isValidObject(slots)) {
|
|
312
312
|
for (const key in slots) {
|
|
313
313
|
if (key.startsWith('toolbar-')) {
|
|
314
314
|
toolbar.push(key.replace('toolbar-', ''))
|
|
@@ -336,13 +336,13 @@ export default {
|
|
|
336
336
|
// ==========【监听数据】=========================================================================================
|
|
337
337
|
|
|
338
338
|
// 如果有树节点点击方法
|
|
339
|
-
if (
|
|
339
|
+
if ($n.isFunction(props.treeNodeClick)) {
|
|
340
340
|
|
|
341
341
|
/**
|
|
342
342
|
* 树节点 all
|
|
343
343
|
*/
|
|
344
344
|
const treeNodesAll = computed(function () {
|
|
345
|
-
return
|
|
345
|
+
return $n.collection(props.treeNodes)
|
|
346
346
|
.keyBy(props.treeNodeKey)
|
|
347
347
|
.toObject()
|
|
348
348
|
})
|
|
@@ -356,7 +356,7 @@ export default {
|
|
|
356
356
|
watch(treeSelected, function(nodeKey) {
|
|
357
357
|
|
|
358
358
|
// 如果节点值不是有效值
|
|
359
|
-
if (!
|
|
359
|
+
if (! $n.isValidValue(nodeKey)) {
|
|
360
360
|
|
|
361
361
|
// 则无任何操作
|
|
362
362
|
return
|
|
@@ -365,7 +365,7 @@ export default {
|
|
|
365
365
|
// 树节点点击
|
|
366
366
|
const res = props.treeNodeClick(nodeKey, treeNodesAll.value[nodeKey])
|
|
367
367
|
|
|
368
|
-
if (
|
|
368
|
+
if ($n.isValidObject(res)) {
|
|
369
369
|
|
|
370
370
|
// 设置表格传参
|
|
371
371
|
$table.setQuery(res)
|
|
@@ -143,6 +143,9 @@ export default {
|
|
|
143
143
|
type: String,
|
|
144
144
|
default: '没有找到任何数据',
|
|
145
145
|
},
|
|
146
|
+
// 不需要加载渲染页面标识参数
|
|
147
|
+
// 额外加载参数 { n_renderpage: 1 }
|
|
148
|
+
noRendPageName: Boolean,
|
|
146
149
|
},
|
|
147
150
|
|
|
148
151
|
/**
|
|
@@ -164,7 +167,7 @@ export default {
|
|
|
164
167
|
* 插槽标识
|
|
165
168
|
*/
|
|
166
169
|
const slotNames = computed(function() {
|
|
167
|
-
return
|
|
170
|
+
return $n.isValidObject(slots) ? Object.keys(slots).filter(e => e !== 'toolbar-right') : []
|
|
168
171
|
})
|
|
169
172
|
|
|
170
173
|
/**
|
|
@@ -182,16 +185,21 @@ export default {
|
|
|
182
185
|
// 如果有已选数据
|
|
183
186
|
if (
|
|
184
187
|
currentSelectedItem.value
|
|
185
|
-
&&
|
|
188
|
+
&& $n.isFunction(props.renderQuery)
|
|
186
189
|
) {
|
|
187
|
-
const
|
|
188
|
-
if (
|
|
189
|
-
|
|
190
|
-
//
|
|
191
|
-
|
|
192
|
-
//
|
|
193
|
-
|
|
194
|
-
|
|
190
|
+
const resQuery = props.renderQuery(currentSelectedItem.value)
|
|
191
|
+
if ($n.isValidObject(resQuery)) {
|
|
192
|
+
|
|
193
|
+
// 如果需要加载渲染页面标识参数
|
|
194
|
+
if (! props.noRendPageName) {
|
|
195
|
+
// 格式化已选数据, 并返回参数
|
|
196
|
+
return Object.assign({}, resQuery, {
|
|
197
|
+
// 是否为渲染页面
|
|
198
|
+
n_renderpage: 1,
|
|
199
|
+
})
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return resQuery
|
|
195
203
|
}
|
|
196
204
|
}
|
|
197
205
|
|
|
@@ -206,6 +214,9 @@ export default {
|
|
|
206
214
|
// 获取表格注入
|
|
207
215
|
const $table = inject(NTableKey)
|
|
208
216
|
|
|
217
|
+
// 原始表格选择状态
|
|
218
|
+
const rawTableSelection = $table.tableSelection.value
|
|
219
|
+
|
|
209
220
|
// 当前已选单条数据
|
|
210
221
|
const currentSelectedItem = ref(null)
|
|
211
222
|
|
|
@@ -289,7 +300,7 @@ export default {
|
|
|
289
300
|
return
|
|
290
301
|
}
|
|
291
302
|
|
|
292
|
-
const selection = showAfter ? 'single' :
|
|
303
|
+
const selection = showAfter ? 'single' : rawTableSelection
|
|
293
304
|
if ($table.tableSelection.value !== selection) {
|
|
294
305
|
$table.tableSelection.value = selection
|
|
295
306
|
|
|
@@ -63,7 +63,7 @@ export default {
|
|
|
63
63
|
})
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
$n.forEach($n.get(props.props, 'cols'), function(item) {
|
|
67
67
|
|
|
68
68
|
const {
|
|
69
69
|
// 标识
|
|
@@ -79,9 +79,9 @@ export default {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
// 如果有统计字段
|
|
82
|
-
if (
|
|
82
|
+
if ($n.has(props.data, name)) {
|
|
83
83
|
// 判断是否是价格
|
|
84
|
-
res.value =
|
|
84
|
+
res.value = $n.has(item, 'price') ? $n.price(props.data[name]) : props.data[name]
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
lists.push(res)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<q-img
|
|
3
3
|
:src="currentSrc"
|
|
4
|
-
:spinner-size="
|
|
5
|
-
:width="
|
|
6
|
-
:height="
|
|
4
|
+
:spinner-size="$n.px(size / 2)"
|
|
5
|
+
:width="$n.px(size)"
|
|
6
|
+
:height="$n.px(size)"
|
|
7
7
|
fit="fill"
|
|
8
8
|
v-if="currentSrc"
|
|
9
9
|
>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<div
|
|
12
12
|
class="absolute-full transparent cursor-pointer"
|
|
13
13
|
@click.prevent.stop="onPreview"
|
|
14
|
-
@dblclick.prevent.stop="
|
|
14
|
+
@dblclick.prevent.stop="$n.noop"
|
|
15
15
|
v-if="preview"
|
|
16
16
|
></div>
|
|
17
17
|
</q-img>
|
|
@@ -60,7 +60,7 @@ export default {
|
|
|
60
60
|
* 当前图片地址
|
|
61
61
|
*/
|
|
62
62
|
const currentSrc = computed(function () {
|
|
63
|
-
const res =
|
|
63
|
+
const res = $n.getImage(props.src, { w: $q.platform.is.mobile ? props.size * 2 : props.size })
|
|
64
64
|
if (res) {
|
|
65
65
|
return res
|
|
66
66
|
}
|
|
@@ -73,7 +73,7 @@ export default {
|
|
|
73
73
|
*/
|
|
74
74
|
function onPreview() {
|
|
75
75
|
// 预览图片
|
|
76
|
-
|
|
76
|
+
$n.previewImage(props.src)
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
return {
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
<div
|
|
45
45
|
class="n-uploader-query__button--square cursor-pointer"
|
|
46
46
|
:style="{
|
|
47
|
-
width:
|
|
48
|
-
height:
|
|
47
|
+
width: $n.px(currentSize),
|
|
48
|
+
height: $n.px(currentSize),
|
|
49
49
|
}"
|
|
50
50
|
@click="uploader.chooseUpload"
|
|
51
51
|
v-show="showSquareButton"
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
>
|
|
54
54
|
<q-icon
|
|
55
55
|
name="add"
|
|
56
|
-
:size="
|
|
56
|
+
:size="$n.px(currentSize / 2)"
|
|
57
57
|
/>
|
|
58
58
|
<div class="n-uploader-query__button--square__text" v-if="buttonText">{{buttonText}}</div>
|
|
59
59
|
</div>
|
|
@@ -76,9 +76,9 @@
|
|
|
76
76
|
>
|
|
77
77
|
<q-img
|
|
78
78
|
:src="getImage(fileItem)"
|
|
79
|
-
:spinner-size="
|
|
80
|
-
:width="
|
|
81
|
-
:height="
|
|
79
|
+
:spinner-size="$n.px(currentSize / 2)"
|
|
80
|
+
:width="$n.px(currentSize)"
|
|
81
|
+
:height="$n.px(currentSize)"
|
|
82
82
|
fit="fill"
|
|
83
83
|
>
|
|
84
84
|
<!-- 内容 -->
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
<q-circular-progress
|
|
100
100
|
indeterminate
|
|
101
101
|
rounded
|
|
102
|
-
:size="
|
|
102
|
+
:size="$n.px(currentSize / 1.5)"
|
|
103
103
|
:thickness="0.14"
|
|
104
104
|
color="white"
|
|
105
105
|
v-if="fileItem.status < UPLOAD_STATUS.uploading"
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
<!-- 上传中 -->
|
|
109
109
|
<q-circular-progress
|
|
110
110
|
:value="fileItem.progress"
|
|
111
|
-
:size="
|
|
111
|
+
:size="$n.px(currentSize / 1.5)"
|
|
112
112
|
:thickness="0.14"
|
|
113
113
|
color="white"
|
|
114
114
|
track-color="grey-5"
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
<q-icon
|
|
119
119
|
class="cursor-pointer"
|
|
120
120
|
name="pause"
|
|
121
|
-
:size="
|
|
121
|
+
:size="$n.px(currentSize / 3)"
|
|
122
122
|
@click="uploader.deleteFileItem(fileItem)"
|
|
123
123
|
/>
|
|
124
124
|
</q-circular-progress>
|
|
@@ -163,8 +163,8 @@
|
|
|
163
163
|
<div
|
|
164
164
|
class="n-uploader-query__button--square cursor-pointer"
|
|
165
165
|
:style="{
|
|
166
|
-
width:
|
|
167
|
-
height:
|
|
166
|
+
width: $n.px(currentSize),
|
|
167
|
+
height: $n.px(currentSize),
|
|
168
168
|
}"
|
|
169
169
|
@click="uploader.chooseUpload"
|
|
170
170
|
v-show="showSquareButton"
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
>
|
|
173
173
|
<q-icon
|
|
174
174
|
name="add"
|
|
175
|
-
:size="
|
|
175
|
+
:size="$n.px(currentSize / 2)"
|
|
176
176
|
/>
|
|
177
177
|
<div class="n-uploader-query__button--square__text" v-if="buttonText">{{buttonText}}</div>
|
|
178
178
|
</div>
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
ghost: fileItemIndex === fromIndex,
|
|
192
192
|
}"
|
|
193
193
|
:style="{
|
|
194
|
-
height:
|
|
194
|
+
height: $n.px(currentSize),
|
|
195
195
|
}"
|
|
196
196
|
:draggable="currentDrag"
|
|
197
197
|
@mousedown.self="mousedown($event, fileItemIndex)"
|
|
@@ -204,8 +204,8 @@
|
|
|
204
204
|
<div
|
|
205
205
|
class="n-uploader-query__item__icon"
|
|
206
206
|
:style="{
|
|
207
|
-
width:
|
|
208
|
-
height:
|
|
207
|
+
width: $n.px(currentSize),
|
|
208
|
+
height: $n.px(currentSize),
|
|
209
209
|
}"
|
|
210
210
|
>
|
|
211
211
|
<!-- 上传中前 -->
|
|
@@ -213,7 +213,7 @@
|
|
|
213
213
|
class="n-uploader-query__item__icon__icon"
|
|
214
214
|
indeterminate
|
|
215
215
|
rounded
|
|
216
|
-
:size="
|
|
216
|
+
:size="$n.px(currentSize / 1.8)"
|
|
217
217
|
:thickness="0.18"
|
|
218
218
|
v-if="fileItem.status < UPLOAD_STATUS.uploading"
|
|
219
219
|
/>
|
|
@@ -222,7 +222,7 @@
|
|
|
222
222
|
<q-circular-progress
|
|
223
223
|
class="n-uploader-query__item__icon__icon"
|
|
224
224
|
:value="fileItem.progress"
|
|
225
|
-
:size="
|
|
225
|
+
:size="$n.px(currentSize / 1.8)"
|
|
226
226
|
:thickness="0.18"
|
|
227
227
|
show-value
|
|
228
228
|
v-else-if="fileItem.status === UPLOAD_STATUS.uploading"
|
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
<q-icon
|
|
231
231
|
class="cursor-pointer"
|
|
232
232
|
name="pause"
|
|
233
|
-
:size="
|
|
233
|
+
:size="$n.px(currentSize / 3)"
|
|
234
234
|
@click="uploader.deleteFileItem(fileItem)"
|
|
235
235
|
/>
|
|
236
236
|
</q-circular-progress>
|
|
@@ -239,7 +239,7 @@
|
|
|
239
239
|
<q-icon
|
|
240
240
|
class="n-uploader-query__item__icon__icon"
|
|
241
241
|
name="description"
|
|
242
|
-
:size="
|
|
242
|
+
:size="$n.px(currentSize / 1.5)"
|
|
243
243
|
v-else-if="type === 'file'"
|
|
244
244
|
/>
|
|
245
245
|
|
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
class="n-uploader-query__item__icon__icon cursor-pointer"
|
|
249
249
|
name="play_circle"
|
|
250
250
|
title="播放"
|
|
251
|
-
:size="
|
|
251
|
+
:size="$n.px(currentSize / 1.5)"
|
|
252
252
|
@click="uploader.play(fileItem)"
|
|
253
253
|
v-else
|
|
254
254
|
/>
|
|
@@ -412,7 +412,7 @@ export default {
|
|
|
412
412
|
*/
|
|
413
413
|
const currentDrag = computed(function() {
|
|
414
414
|
return props.drag
|
|
415
|
-
&&
|
|
415
|
+
&& $n.isValidArray(query.value)
|
|
416
416
|
&& query.value.length > 1
|
|
417
417
|
})
|
|
418
418
|
|
|
@@ -454,11 +454,11 @@ export default {
|
|
|
454
454
|
* 获取图片地址
|
|
455
455
|
*/
|
|
456
456
|
function getImage(fileItem) {
|
|
457
|
-
return
|
|
457
|
+
return $n.has(fileItem, '__img') ?
|
|
458
458
|
fileItem.__img
|
|
459
459
|
: (
|
|
460
|
-
|
|
461
|
-
|
|
460
|
+
$n.isValidString(fileItem.hash) ?
|
|
461
|
+
$n.getImage(fileItem.hash, { w: $q.platform.is.mobile ? currentSize.value * 2 : currentSize.value })
|
|
462
462
|
: ''
|
|
463
463
|
)
|
|
464
464
|
}
|
|
@@ -467,7 +467,7 @@ export default {
|
|
|
467
467
|
* 获取文件名称
|
|
468
468
|
*/
|
|
469
469
|
function getFileName(fileItem) {
|
|
470
|
-
return fileItem.title + (
|
|
470
|
+
return fileItem.title + ($n.get(fileItem, 'ext') ? '.' + fileItem.ext : '')
|
|
471
471
|
}
|
|
472
472
|
|
|
473
473
|
// ==========【生命周期】=========================================================================================
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<slot
|
|
3
|
-
:
|
|
4
|
-
:
|
|
3
|
+
:scope="current"
|
|
4
|
+
:emit="emitValue"
|
|
5
5
|
/>
|
|
6
6
|
</template>
|
|
7
7
|
|
|
@@ -10,6 +10,11 @@ import { ref, watch } from 'vue'
|
|
|
10
10
|
|
|
11
11
|
export default {
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* 关闭组件 attribute 透传行为
|
|
15
|
+
*/
|
|
16
|
+
inheritAttrs: false,
|
|
17
|
+
|
|
13
18
|
/**
|
|
14
19
|
* 标识
|
|
15
20
|
*/
|
|
@@ -46,7 +51,16 @@ export default {
|
|
|
46
51
|
// ==========【数据】============================================================================================
|
|
47
52
|
|
|
48
53
|
// 当前值
|
|
49
|
-
const
|
|
54
|
+
const current = ref({
|
|
55
|
+
value: formatModelValue(props.modelValue),
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
// 如果是自动触发更新
|
|
59
|
+
if (! props.noEmit) {
|
|
60
|
+
// 触发更新值
|
|
61
|
+
// 此处用于判断声明值是否有改变
|
|
62
|
+
emitValue()
|
|
63
|
+
}
|
|
50
64
|
|
|
51
65
|
// ==========【监听数据】=========================================================================================
|
|
52
66
|
|
|
@@ -56,7 +70,7 @@ export default {
|
|
|
56
70
|
watch(() => props.modelValue, function (val) {
|
|
57
71
|
|
|
58
72
|
// 格式化声明值
|
|
59
|
-
|
|
73
|
+
current.value.value = formatModelValue(val)
|
|
60
74
|
|
|
61
75
|
}, {
|
|
62
76
|
// 深度监听
|
|
@@ -66,18 +80,15 @@ export default {
|
|
|
66
80
|
/**
|
|
67
81
|
* 监听当前值
|
|
68
82
|
*/
|
|
69
|
-
watch(
|
|
83
|
+
watch(current, function (value) {
|
|
70
84
|
|
|
71
|
-
//
|
|
72
|
-
if (props.noEmit) {
|
|
85
|
+
// 如果是自动触发更新
|
|
86
|
+
if (! props.noEmit) {
|
|
73
87
|
|
|
74
|
-
//
|
|
75
|
-
|
|
88
|
+
// 立即执行触发更新值
|
|
89
|
+
emitValue(value.value)
|
|
76
90
|
}
|
|
77
91
|
|
|
78
|
-
// 立即执行触发更新值
|
|
79
|
-
emitValue(value)
|
|
80
|
-
|
|
81
92
|
}, {
|
|
82
93
|
// 深度监听
|
|
83
94
|
deep: true,
|
|
@@ -89,7 +100,7 @@ export default {
|
|
|
89
100
|
* 格式化声明值
|
|
90
101
|
*/
|
|
91
102
|
function formatModelValue(value) {
|
|
92
|
-
return
|
|
103
|
+
return $n.isFunction(props.before)
|
|
93
104
|
// 如果有修改前值方法
|
|
94
105
|
? props.before({ value, formatArray, formatString })
|
|
95
106
|
// 返回值
|
|
@@ -99,17 +110,36 @@ export default {
|
|
|
99
110
|
/**
|
|
100
111
|
* 触发更新值
|
|
101
112
|
*/
|
|
102
|
-
function emitValue(
|
|
113
|
+
function emitValue() {
|
|
114
|
+
|
|
115
|
+
// if (
|
|
116
|
+
// value !== void 0
|
|
117
|
+
// && typeof value === 'object'
|
|
118
|
+
// && value instanceof Event
|
|
119
|
+
// ) {
|
|
120
|
+
// // 停止冒泡
|
|
121
|
+
// value.stopPropagation()
|
|
122
|
+
//
|
|
123
|
+
// // 获取当前值
|
|
124
|
+
// value = current.value.value
|
|
125
|
+
// }
|
|
126
|
+
|
|
127
|
+
// 获取当前值
|
|
128
|
+
const value = current.value.value
|
|
129
|
+
|
|
130
|
+
// 获取新值
|
|
131
|
+
const newValue = $n.isFunction(props.after) ?
|
|
132
|
+
// 如果有修改提交值方法
|
|
133
|
+
props.after({ value, formatArray, formatString })
|
|
134
|
+
// 否则返回当前值
|
|
135
|
+
: value
|
|
103
136
|
|
|
104
|
-
//
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// 否则返回当前值
|
|
111
|
-
: value
|
|
112
|
-
)
|
|
137
|
+
// 如果值有改变
|
|
138
|
+
if (newValue !== props.modelValue) {
|
|
139
|
+
|
|
140
|
+
// 触发更新值
|
|
141
|
+
emit('update:modelValue', newValue)
|
|
142
|
+
}
|
|
113
143
|
}
|
|
114
144
|
|
|
115
145
|
/**
|
|
@@ -130,24 +160,24 @@ export default {
|
|
|
130
160
|
toString: false,
|
|
131
161
|
}, params)
|
|
132
162
|
|
|
133
|
-
val =
|
|
163
|
+
val = $n.isValidArray(val) ? val : []
|
|
134
164
|
|
|
135
165
|
// 如果数组有值
|
|
136
166
|
if (val.length) {
|
|
137
167
|
|
|
138
168
|
// 是否给每个值去除首位空格
|
|
139
169
|
if (o.trim) {
|
|
140
|
-
val = val.map(e =>
|
|
170
|
+
val = val.map(e => $n.trimString(e))
|
|
141
171
|
}
|
|
142
172
|
|
|
143
173
|
// 是否验证每个值是否为有效字符串/数字
|
|
144
174
|
if (o.isValidValue) {
|
|
145
|
-
val = val.filter(val =>
|
|
175
|
+
val = val.filter(val => $n.isValidValue(val))
|
|
146
176
|
}
|
|
147
177
|
|
|
148
178
|
// 去重
|
|
149
179
|
if (o.unique) {
|
|
150
|
-
val =
|
|
180
|
+
val = $n.uniq(val)
|
|
151
181
|
}
|
|
152
182
|
}
|
|
153
183
|
|
|
@@ -169,7 +199,7 @@ export default {
|
|
|
169
199
|
// 是否给每个值去除首位空格
|
|
170
200
|
trim: true,
|
|
171
201
|
// 替换内容
|
|
172
|
-
replace: /\n
|
|
202
|
+
replace: /\n|,|,|\s+/g,
|
|
173
203
|
// 是否去重
|
|
174
204
|
unique: true,
|
|
175
205
|
// 分隔符
|
|
@@ -183,18 +213,15 @@ export default {
|
|
|
183
213
|
// 是否去除首尾空格
|
|
184
214
|
if (o.trim) {
|
|
185
215
|
// 去除首尾空格
|
|
186
|
-
val =
|
|
216
|
+
val = $n.trimString(val)
|
|
187
217
|
|
|
188
218
|
// 否则转字符串
|
|
189
219
|
} else {
|
|
190
|
-
val =
|
|
220
|
+
val = $n.isValidValue(val) ? String(val) : ''
|
|
191
221
|
}
|
|
192
222
|
|
|
193
223
|
// 如果有分割符
|
|
194
|
-
if (
|
|
195
|
-
|
|
196
|
-
// 分隔符
|
|
197
|
-
o.separator = utils.trimString(o.separator)
|
|
224
|
+
if ($n.isValidValue(o.separator, true)) {
|
|
198
225
|
|
|
199
226
|
// 是否替换
|
|
200
227
|
if (o.replace) {
|
|
@@ -202,16 +229,16 @@ export default {
|
|
|
202
229
|
}
|
|
203
230
|
|
|
204
231
|
// 分隔成数组
|
|
205
|
-
val =
|
|
232
|
+
val = $n.split(val, o.separator)
|
|
206
233
|
|
|
207
234
|
// 如果去重
|
|
208
235
|
if (o.unique) {
|
|
209
|
-
val =
|
|
236
|
+
val = $n.uniq(val)
|
|
210
237
|
}
|
|
211
238
|
|
|
212
239
|
// 如果验证每个值是否为有效字符串/数字
|
|
213
240
|
if (o.isValidValue) {
|
|
214
|
-
val = val.filter(val =>
|
|
241
|
+
val = val.filter(val => $n.isValidValue(val))
|
|
215
242
|
}
|
|
216
243
|
|
|
217
244
|
// 如果转数组
|
|
@@ -231,7 +258,7 @@ export default {
|
|
|
231
258
|
|
|
232
259
|
return {
|
|
233
260
|
// 当前值
|
|
234
|
-
|
|
261
|
+
current,
|
|
235
262
|
// 触发更新值
|
|
236
263
|
emitValue,
|
|
237
264
|
}
|