lw-cdp-ui 1.5.55 → 1.5.57
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/dist/components/lwAi/index.vue +0 -2
- package/dist/components/lwTour/index.vue +32 -35
- package/dist/lw-cdp-ui.esm.js +1607 -1619
- package/dist/lw-cdp-ui.umd.js +16 -16
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
<script>
|
|
20
20
|
import axios from 'axios';
|
|
21
21
|
import { computed, getCurrentInstance, ref, watch } from 'vue';
|
|
22
|
-
import { useRouter } from 'vue-router';
|
|
23
22
|
import { FORM_DATA_GENERATION_RULES, SAFETY_RULES } from './doc/rules.js';
|
|
24
23
|
|
|
25
24
|
export default {
|
|
@@ -46,7 +45,6 @@ export default {
|
|
|
46
45
|
const {
|
|
47
46
|
proxy: { $http, $expression, t, $tool, $bus }
|
|
48
47
|
} = getCurrentInstance()
|
|
49
|
-
const router = useRouter()
|
|
50
48
|
const visible = ref(false)
|
|
51
49
|
const loading = ref(false)
|
|
52
50
|
const inputValue = ref('')
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
:key="index"
|
|
6
6
|
:target="step.target"
|
|
7
7
|
:title="step.title"
|
|
8
|
-
:description="step.description"
|
|
8
|
+
:description="step.description"
|
|
9
|
+
@change="changeStep" />
|
|
9
10
|
</el-tour>
|
|
10
11
|
</template>
|
|
11
12
|
|
|
12
13
|
<script>
|
|
13
|
-
import {
|
|
14
|
-
import { useRouter } from 'vue-router'
|
|
14
|
+
import { getCurrentInstance, nextTick, onMounted, onUnmounted, ref } from 'vue'
|
|
15
15
|
|
|
16
16
|
export default {
|
|
17
17
|
name: 'LwTour',
|
|
@@ -33,13 +33,17 @@ export default {
|
|
|
33
33
|
currentStep: {
|
|
34
34
|
type: Number,
|
|
35
35
|
default: 0
|
|
36
|
+
},
|
|
37
|
+
// 路由路径,用于记录用户是否已完成引导
|
|
38
|
+
routePath: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: ''
|
|
36
41
|
}
|
|
37
42
|
},
|
|
38
43
|
setup(props, { emit }) {
|
|
39
44
|
const {
|
|
40
45
|
proxy: { $api, $expression, t, $tool, $bus }
|
|
41
46
|
} = getCurrentInstance()
|
|
42
|
-
const router = useRouter()
|
|
43
47
|
$bus.$on(`lwTourChange`, () => {
|
|
44
48
|
startTour()
|
|
45
49
|
})
|
|
@@ -53,26 +57,6 @@ export default {
|
|
|
53
57
|
|
|
54
58
|
// 开始引导
|
|
55
59
|
const startTour = () => {
|
|
56
|
-
// 如果 router 未初始化,延迟执行
|
|
57
|
-
if (!router) {
|
|
58
|
-
setTimeout(() => {
|
|
59
|
-
startTour()
|
|
60
|
-
}, 100)
|
|
61
|
-
return
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const allElementsExist = props.steps.every((step) => {
|
|
65
|
-
return document.querySelector(step.css)
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
if (!allElementsExist) {
|
|
69
|
-
console.warn('元素未加载完成')
|
|
70
|
-
setTimeout(() => {
|
|
71
|
-
startTour()
|
|
72
|
-
}, 100)
|
|
73
|
-
return
|
|
74
|
-
}
|
|
75
|
-
|
|
76
60
|
formattedSteps.value = props.steps.map((step) => {
|
|
77
61
|
const targetElement = document.querySelector(step.css)
|
|
78
62
|
return {
|
|
@@ -84,22 +68,20 @@ export default {
|
|
|
84
68
|
})
|
|
85
69
|
isOpen.value = true
|
|
86
70
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
LwTour[`${meta?.title || ''}${path}`] = true
|
|
71
|
+
// 使用传入的路由路径
|
|
72
|
+
if (props.routePath) {
|
|
73
|
+
let LwTour = $tool.data.get('LwTour') || {}
|
|
74
|
+
LwTour[props.routePath] = true
|
|
92
75
|
$tool.data.set('LwTour', LwTour)
|
|
93
76
|
}
|
|
94
77
|
}
|
|
95
78
|
|
|
96
79
|
// 组件挂载后自动开始引导
|
|
97
80
|
onMounted(() => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (!LwTour[`${meta?.title || ''}${path}`]) {
|
|
81
|
+
// 使用传入的路由路径
|
|
82
|
+
if (props.routePath) {
|
|
83
|
+
let LwTour = $tool.data.get('LwTour') || {}
|
|
84
|
+
if (!LwTour[props.routePath]) {
|
|
103
85
|
nextTick(() => {
|
|
104
86
|
startTour()
|
|
105
87
|
})
|
|
@@ -108,10 +90,25 @@ export default {
|
|
|
108
90
|
$bus.$emit(`lwTourOpen`, true)
|
|
109
91
|
})
|
|
110
92
|
|
|
93
|
+
// 步骤变化时
|
|
94
|
+
const changeStep = (step) => {
|
|
95
|
+
emit('change', step)
|
|
96
|
+
formattedSteps.value = props.steps.map((step) => {
|
|
97
|
+
const targetElement = document.querySelector(step.css)
|
|
98
|
+
return {
|
|
99
|
+
target: targetElement || undefined,
|
|
100
|
+
title: step.title,
|
|
101
|
+
description: step.description,
|
|
102
|
+
placement: 'bottom'
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
|
|
111
107
|
return {
|
|
112
108
|
formattedSteps,
|
|
113
109
|
isOpen,
|
|
114
|
-
startTour
|
|
110
|
+
startTour,
|
|
111
|
+
changeStep
|
|
115
112
|
}
|
|
116
113
|
}
|
|
117
114
|
}
|