I’m trying to use vue3-tour, but the documentation only shows how to use it with options API. I found a closed issue where it was shown how to use it with composition API.
This is my code right now:
// main.ts
import { createApp } from "vue";
import router from "./router";
import VueTour from "vue3-tour";
import App from "./App.vue";
const app = createApp(App).use(router).use(VueTour);
app.provide("tours", app.config.globalProperties.$tours);
app.mount("#app");
<script setup lang="ts">
import NavigationDrawer from "@/components/NavigationDrawer.vue";
import { inject, onMounted } from "vue";
const tours: any = inject("tours");
const homeSteps = [
{
target: "#owner-btn",
content: "Click this button to create a owner.",
},
];
onMounted(() => {
tours["home-tour"].start();
});
</script>
<template>
<v-app>
<NavigationDrawer />
<v-main>
<v-container>
<router-view />
</v-container>
</v-main>
<v-tour name="home-tour" :steps="homeSteps"></v-tour>
</v-app>
</template>
Unluckly, tours
is undefined
. What am I missing? How can I solve this issue?