szboynono / mosha-vue-toastify

A light weight and fun Vue 3 toast or notification or snack bar or however you wanna call it library.

Home Page:https://szboynono.github.io/mosha-vue-toastify/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pass props to custom component

loukkyy opened this issue · comments

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

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!

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

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

It works! Thanks for this amazing component!
Screenshot 2021-07-13 at 23 23 43