mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 02:02:21 +00:00
The guided walk finds its elements in the rendered tree
Template refs are filled after a render returns, and later still when the walk starts inside one of Vue's own post-render updates, where the walk would have failed with its listeners already in place. Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
10a26e15ce
commit
4a6f185d07
3 files changed
+35
-15
No files matched your search
@@ -1,5 +1,4 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiCloseButton from '../../kit/UiCloseButton.vue';
|
||||
|
||||
@@ -9,7 +8,7 @@ import UiCloseButton from '../../kit/UiCloseButton.vue';
|
||||
// with the `view` it computes for each step and keeps the parts the template
|
||||
// never binds: the guide's `visible` class, the callout's entrance replay
|
||||
// (its `swap` class), place and side, the ring's and the extra rings' boxes,
|
||||
// and focus. The elements those parts need are exposed.
|
||||
// and focus. It finds those elements in the rendered tree itself.
|
||||
defineProps({
|
||||
to: { type: Object, required: true },
|
||||
view: { type: Object, required: true },
|
||||
@@ -19,21 +18,15 @@ defineProps({
|
||||
onNext: { type: Function, required: true },
|
||||
});
|
||||
|
||||
const root = ref(null);
|
||||
const ring = ref(null);
|
||||
const callout = ref(null);
|
||||
defineExpose({ root, ring, callout });
|
||||
|
||||
/** A progress segment's attributes: no class at all for one still to come. */
|
||||
const dot = (name) => (name ? { class: name } : {});
|
||||
</script>
|
||||
|
||||
<!-- Only line breaks inside tags: the markup has no whitespace between elements. -->
|
||||
<template><Teleport :to="to"
|
||||
><div ref="root" class="gev-guide"
|
||||
><div ref="ring" class="gev-guide-ring"><i></i></div
|
||||
><div class="gev-guide"
|
||||
><div class="gev-guide-ring"><i></i></div
|
||||
><div
|
||||
ref="callout"
|
||||
class="gev-guide-callout"
|
||||
role="dialog"
|
||||
aria-modal="false"
|
||||
|
||||
Reference in new issue
Block a user