jobdone-shared-files 1.0.11 → 1.0.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/autocompleteSelect.vue +2 -12
- package/package.json +1 -1
package/autocompleteSelect.vue
CHANGED
|
@@ -234,7 +234,6 @@ const selectedItem = computed(() => {
|
|
|
234
234
|
function previewAdjust(itemObj) {
|
|
235
235
|
if (props.previewKey !== '') {
|
|
236
236
|
let strAry = props.previewKey.split('+')
|
|
237
|
-
let obj = toRaw(itemObj)
|
|
238
237
|
let isUndefined = false
|
|
239
238
|
|
|
240
239
|
let finalStr = strAry.reduce((acc, cur) => {
|
|
@@ -242,10 +241,10 @@ function previewAdjust(itemObj) {
|
|
|
242
241
|
if (v.match(/'[^']+'/g)) {
|
|
243
242
|
return acc + v.substring(1, v.length - 1)
|
|
244
243
|
} else {
|
|
245
|
-
if (
|
|
244
|
+
if (itemObj[v] === undefined) {
|
|
246
245
|
isUndefined = true
|
|
247
246
|
}
|
|
248
|
-
return acc +
|
|
247
|
+
return acc + itemObj[v]
|
|
249
248
|
}
|
|
250
249
|
}, '')
|
|
251
250
|
if (isUndefined) {
|
|
@@ -256,16 +255,10 @@ function previewAdjust(itemObj) {
|
|
|
256
255
|
return itemObj
|
|
257
256
|
}
|
|
258
257
|
|
|
259
|
-
// 強制更新selectedPreviewText
|
|
260
|
-
const selectedPreviewTextUpdateCount = ref(0)
|
|
261
|
-
function selectedPreviewTextUpdate() {
|
|
262
|
-
selectedPreviewTextUpdateCount.value++
|
|
263
|
-
}
|
|
264
258
|
|
|
265
259
|
// 選中的值的顯示
|
|
266
260
|
const selectedPreviewText = computed(() => {
|
|
267
261
|
|
|
268
|
-
let updateComputed = selectedPreviewTextUpdateCount.value + 1 // 讓外部可以強制更新這個computed,不要刪除
|
|
269
262
|
|
|
270
263
|
if (!selectedItem.value || Object.keys(selectedItem.value).length === 0) {
|
|
271
264
|
return props.placeholder
|
|
@@ -275,7 +268,6 @@ const selectedPreviewText = computed(() => {
|
|
|
275
268
|
|
|
276
269
|
// 清除選擇內容
|
|
277
270
|
function clearSelected() {
|
|
278
|
-
selectedPreviewTextUpdateCount.value = 0
|
|
279
271
|
emit('select', props.resetValue)
|
|
280
272
|
leave()
|
|
281
273
|
}
|
|
@@ -285,7 +277,6 @@ function selectConfirm(v) {
|
|
|
285
277
|
if (!v) {
|
|
286
278
|
return
|
|
287
279
|
}
|
|
288
|
-
selectedPreviewTextUpdate()
|
|
289
280
|
emit('select', JSON.parse(JSON.stringify(v)))
|
|
290
281
|
leave()
|
|
291
282
|
keyboardSwitchIndexReset()
|
|
@@ -298,7 +289,6 @@ function keyboardSelectConfirm(event) {
|
|
|
298
289
|
}
|
|
299
290
|
if (filterList.value?.length) {
|
|
300
291
|
selectConfirm(filterList.value[keyboardSwitchIndex.value])
|
|
301
|
-
selectedPreviewTextUpdate()
|
|
302
292
|
}
|
|
303
293
|
}
|
|
304
294
|
|