// main.ts
import '94-toast/style.css'
import { ToastPlugin } from '94-toast';
const app = createApp(App);
app.use(ToastPlugin);
app.mount('#app');
<script lang="ts">
export default {
name: "App",
methods: {
toast() {
this.$toast.show('Hello Vuejs')
}
}
}
</script>
<script setup lang="ts">
import { getCurrentInstance } from 'vue';
const global = getCurrentInstance()?.appContext.config.globalProperties;
const toast = () => {
global?.$toast.show('Hello Vuejs')
}
</script>
<script lang="ts">
import { defineComponent, getCurrentInstance } from 'vue';
export default defineComponent({
name: "App",
setup() {
const global = getCurrentInstance()?.appContext.config.globalProperties;
const toast = () => {
global?.$toast.show('Hello Vuejs')
}
return {
toast,
}
}
})
</script>