Open wadimsewo opened 3 years ago
Hi,
Haven't thought about it yet. I will research it once I have some free time
Is it something similar you would like to see? https://vuedose.tips/create-a-i18n-plugin-with-composition-api-in-vuejs-3/
@wadimsewo I did it by creating a file to wrap methods.notify
like this:
notify.js
import { methods } from 'vue3-vt-notifications/src/notifications.js'
export default methods.notify.bind(methods)
And then, I accessed it in my setup like:
Component.vue
<template>
<div @click="onClick">Click me!</div>
</template>
<script>
import notify from './notify';
export default {
setup(){
const onClick = () => notify({
type: 'success',
title: 'Congrats!',
text: 'You clicked me!',
}, 3000);
return { onClick };
}
}
</script>
<style>
</style>
Above solution isn't working for me don't know why!
I also tried below in setup but it just doesn't work for me!
import { getCurrentInstance } from 'vue' const app = getCurrentInstance() app.appContext.config.globalProperties.$notify( { type: 'success', title: 'Congrats!', text: 'You clicked me!', }, 3000 )
@vishvendrasingh, try this fork of notifications library https://github.com/emmanuelsw/notiwind.
Hi, how is it accessible in the composition API?
Best greets, Wadim