I recently made the transition from using vue 3 to nuxt 3 for my project. In vue, I was utilizing the vue-toastification module but after migrating to nuxt, I'm facing difficulties importing it correctly into my code. Here's a snippet of how I was using the module:
import { useToast, POSITION } from 'vue-toastification'
const toast = useToast()
export default {
methods: {
copy(text) {
toast.success('Copied!', {
timeout: 2000,
position: POSITION.BOTTOM_CENTER,
})
navigator.clipboard.writeText(text)
}
}
}
In Vue, I had to include app.use(Toast)
, however, in Nuxt, there is no index.js file to add this line. I attempted to add
modules: ['vue-toastification/nuxt']
in my nuxt.config.js file but encountered an error.