vue2-client 1.12.50 → 1.12.52
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
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</div>
|
|
16
16
|
<!-- 自定义标题 -->
|
|
17
17
|
<template #title>
|
|
18
|
-
<div class="custom-title" @click="
|
|
18
|
+
<div class="custom-title" @click="cardClick(card, 'cardclick', itemIndex)">
|
|
19
19
|
<a-tooltip placement="top">
|
|
20
20
|
<template #title>{{ card[config.id] }}</template>
|
|
21
21
|
<div class="title-id" v-if="card[config.id]">{{ card[config.id] }}</div>
|
|
@@ -278,7 +278,7 @@ export default {
|
|
|
278
278
|
three: '未获取到配置',
|
|
279
279
|
four: '未获取到配置',
|
|
280
280
|
five: '未获取到配置',
|
|
281
|
-
six: 70
|
|
281
|
+
six: 70,
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
// 测试数据初始化
|
|
@@ -307,28 +307,20 @@ export default {
|
|
|
307
307
|
}
|
|
308
308
|
return result
|
|
309
309
|
},
|
|
310
|
-
|
|
310
|
+
async cardClick (card, itemIndex) {
|
|
311
|
+
try {
|
|
312
|
+
// 等待 beforeSwitch 完全执行完成
|
|
313
|
+
const result = await this.beforeSwitch(card, 'beforeSwitch', itemIndex)
|
|
314
|
+
// 如果返回 undefined 说明没有监听器,或者返回 true 说明检查通过
|
|
315
|
+
if (result === undefined || result === true) {
|
|
316
|
+
await this.clickFooter(card, 'cardclick', itemIndex)
|
|
317
|
+
}
|
|
318
|
+
} catch (error) {
|
|
319
|
+
}
|
|
320
|
+
},
|
|
311
321
|
// 点击按钮
|
|
312
322
|
async clickFooter (data, eventName, index) {
|
|
313
323
|
if (eventName === 'cardclick') {
|
|
314
|
-
// 先触发 beforeSwitch 事件
|
|
315
|
-
if (this.data && Array.isArray(this.data)) {
|
|
316
|
-
for (const item of this.data) {
|
|
317
|
-
if (item.isClicked) {
|
|
318
|
-
// 使用 Promise 包装 beforeSwitch 事件
|
|
319
|
-
await new Promise((resolve, reject) => {
|
|
320
|
-
try {
|
|
321
|
-
// 执行 beforeSwitch 事件
|
|
322
|
-
this.$emit('cardEmit', item, 'beforeSwitch')
|
|
323
|
-
resolve()
|
|
324
|
-
} catch (error) {
|
|
325
|
-
reject(error)
|
|
326
|
-
}
|
|
327
|
-
})
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
// 如果上面的代码块执行成功,才会执行下面的代码
|
|
332
324
|
// 清除所有卡片的点击状态
|
|
333
325
|
if (this.data && Array.isArray(this.data)) {
|
|
334
326
|
this.data.forEach(item => {
|
|
@@ -342,6 +334,32 @@ export default {
|
|
|
342
334
|
}
|
|
343
335
|
this.$emit('cardEmit', data, eventName)
|
|
344
336
|
},
|
|
337
|
+
async beforeSwitch (data, eventName, index) {
|
|
338
|
+
return new Promise((resolve) => {
|
|
339
|
+
// 检查是否有其他卡片已经被点击
|
|
340
|
+
const hasClickedCard = this.data.some(item => item.isClicked)
|
|
341
|
+
// 如果没有任何卡片被点击过,直接通过
|
|
342
|
+
if (!hasClickedCard) {
|
|
343
|
+
resolve(true)
|
|
344
|
+
return
|
|
345
|
+
}
|
|
346
|
+
// 检查是否有监听器
|
|
347
|
+
const hasListeners = this._events?.cardEmit?.length > 0
|
|
348
|
+
|
|
349
|
+
// 如果没有监听器,返回 undefined 表示继续执行
|
|
350
|
+
if (!hasListeners) {
|
|
351
|
+
resolve(undefined)
|
|
352
|
+
return
|
|
353
|
+
}
|
|
354
|
+
// 如果有监听器,执行事件检查
|
|
355
|
+
try {
|
|
356
|
+
this.$emit('cardEmit', data, eventName)
|
|
357
|
+
resolve(true)
|
|
358
|
+
} catch (error) {
|
|
359
|
+
resolve(false)
|
|
360
|
+
}
|
|
361
|
+
})
|
|
362
|
+
},
|
|
345
363
|
// 获取数据
|
|
346
364
|
loadData () {
|
|
347
365
|
this.render = false
|
|
@@ -49,7 +49,7 @@ export default {
|
|
|
49
49
|
return {
|
|
50
50
|
isOpen: true,
|
|
51
51
|
// 定义主内容区域的最大和最小宽度百分比
|
|
52
|
-
mainWithData: [{ max:
|
|
52
|
+
mainWithData: [{ max: 17, min: 17 }, { max: 78, min: 56 }]
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
mounted () {
|
|
@@ -82,8 +82,8 @@ export default {
|
|
|
82
82
|
return []
|
|
83
83
|
}
|
|
84
84
|
// 获取a-row中的所有a-col
|
|
85
|
-
const allCol1 = Array.from(row.querySelectorAll('.ant-col-
|
|
86
|
-
const allCol2 = Array.from(row.querySelectorAll('.ant-col-
|
|
85
|
+
const allCol1 = Array.from(row.querySelectorAll('.ant-col-4'))
|
|
86
|
+
const allCol2 = Array.from(row.querySelectorAll('.ant-col-14'))
|
|
87
87
|
const allCols = [...allCol1, ...allCol2]
|
|
88
88
|
// 过滤掉当前a-col,返回其他所有a-col
|
|
89
89
|
return allCols.filter(col => col !== currentCol)
|
|
@@ -107,7 +107,7 @@ export default {
|
|
|
107
107
|
}
|
|
108
108
|
if (currentCol) {
|
|
109
109
|
// 更新当前列的宽度
|
|
110
|
-
const drawerWidth = isOpen ?
|
|
110
|
+
const drawerWidth = isOpen ? 25 : 2
|
|
111
111
|
currentCol.style.flex = `0 0 ${drawerWidth}%`
|
|
112
112
|
currentCol.style.maxWidth = `${drawerWidth}%`
|
|
113
113
|
// 根据mainWithData设置其他列的宽度
|