szboynono / mosha-vue-toastify

A light weight and fun Vue 3 toast or notification or snack bar or however you wanna call it library.
https://szboynono.github.io/mosha-vue-toastify/
MIT License
223 stars 15 forks source link

Pass props to custom component #5

Closed loukkyy closed 3 years ago

loukkyy commented 3 years ago

Great project! Thanks! Using Vue3 + Vite, can I pass props to my custom component used for the toast?

szboynono commented 3 years ago

Hi, thanks for the feedback! As of v1.0.14, you can with props into the custom component with the withProps function.

example:

    // with props
    import { createToast, withProps } from 'mosha-vue-toastify';
    import CustomizedContent from "./CustomizedContent.vue";
    import 'mosha-vue-toastify/dist/style.css';

    export default defineComponent({
      setup () {
        const toast = () => {
            createToast(withProps(CustomizedContent, { yourFavProp: 'bruh' }))
        }
        return { toast }
      }
    })

Great feedback, thanks again!

loukkyy commented 3 years ago

Amazing! Just bump my version to 1.0.15 but seems withProps is not exposed:

Uncaught SyntaxError: The requested module '/node_modules/.vite/mosha-vue-toastify.js?v=fe23573f' does not provide an export named 'withProps'

Link to my repo

szboynono commented 3 years ago

Thanks again!.. That was my bad, something went wrong in the pipeline so the latest build ddnt get published property, can you try version 1.0.17? it should be fine now

loukkyy commented 3 years ago

It works! Thanks for this amazing component!

Screenshot 2021-07-13 at 23 23 43