fix appContext
This commit is contained in:
+7
-1
@@ -11,6 +11,7 @@ import PageIndex from './pages/Index.vue'
|
||||
import PageNestedComponents from './pages/NestedComponents.vue'
|
||||
import PageSingletonComponents from './pages/SingletonComponents.vue'
|
||||
import PageWga from './pages/Wga.vue'
|
||||
import PageAppContext from './pages/AppContext.vue'
|
||||
import ReactiveProps from './pages/ReactiveProps.vue'
|
||||
import Testing from './pages/Testing.vue'
|
||||
import ReactiveState from './pages/ReactiveState.vue'
|
||||
@@ -29,6 +30,7 @@ const router = createRouter({
|
||||
{ path: '/reactive-state', component: ReactiveState },
|
||||
{ path: '/theme', component: Theme },
|
||||
{ path: '/wga', component: PageWga },
|
||||
{ path: '/app-context', component: PageAppContext },
|
||||
]
|
||||
})
|
||||
|
||||
@@ -37,8 +39,12 @@ const app = createApp(App)
|
||||
app.component('counter', Counter)
|
||||
app.component("ui-icon", UiIcon);
|
||||
|
||||
app.provide('settings', {
|
||||
appName: 'Vue Tippy',
|
||||
})
|
||||
|
||||
app.use(router)
|
||||
app.use(VueTippy, {
|
||||
defaultProps: { placement: 'right' },
|
||||
})
|
||||
app.mount('#app')
|
||||
app.mount('#app')
|
||||
@@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<button ref="btn">Hi!</button>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, h, defineComponent, resolveComponent, inject } from "vue";
|
||||
import { useTippy } from "../../src";
|
||||
|
||||
const btn = ref()
|
||||
|
||||
useTippy(btn, {
|
||||
interactive: true,
|
||||
content: defineComponent({
|
||||
setup() {
|
||||
const settings = inject("settings") as any
|
||||
|
||||
return () => h("div", {}, [
|
||||
JSON.stringify(settings),
|
||||
h(resolveComponent("counter")),
|
||||
])
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user