Skip to content

Commit cafa796

Browse files
authored
feat(guide): triggered only when showStep is true (#3926)
* feat(guide): [guide] triggered only when showStep is true * feat(guide): triggered only when showStep is true * feat: edit callback demo and basic-usage demo * feat(guide): triggered only when showStep is true
1 parent b2541ef commit cafa796

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

examples/sites/demos/pc/app/guide/basic-usage-composition-api.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ const domData = ref([
4141
text: '完成',
4242
action: 'complete'
4343
}
44-
]
44+
],
45+
destroy: () => {
46+
showStep.value = false
47+
}
4548
}
4649
])
4750

examples/sites/demos/pc/app/guide/basic-usage.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ export default {
4848
text: '下一步',
4949
action: 'next'
5050
}
51-
]
51+
],
52+
destroy: () => {
53+
this.showStep = false
54+
}
5255
}
5356
]
5457
}

examples/sites/demos/pc/app/guide/callback-composition-api.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ const domData = ref([
131131
],
132132
destroy: () => {
133133
label.value = 'destroy'
134+
showStep.value = false
134135
},
135136
complete: () => {
136137
label.value = 'complete'

examples/sites/demos/pc/app/guide/callback.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export default {
137137
],
138138
destroy: () => {
139139
this.label = 'destroy'
140+
this.showStep = false
140141
},
141142
complete: () => {
142143
this.label = 'complete'

packages/renderless/src/guide/vue.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,16 @@ export const renderless = (
3434
beforeUnmount: beforeUnmount(state)
3535
}
3636

37-
watch(() => props.showStep, api.createShepherd)
37+
watch(
38+
() => props.showStep,
39+
(newVal) => {
40+
if (newVal) {
41+
api.createShepherd()
42+
} else {
43+
state?.tour?.hide()
44+
}
45+
}
46+
)
3847

3948
onMounted(api.mounted)
4049
onBeforeUnmount(api.beforeUnmount)

0 commit comments

Comments
 (0)