nandi95 / vue-toastify

🔥 Simple, extendable, dependency free notification plugin. 🔥
https://vue-toastify.netlify.com/
MIT License
227 stars 12 forks source link

Request feature to allow component import #15

Closed bedus-creation closed 4 years ago

bedus-creation commented 4 years ago

I have been using this package from two years with laravel blade as well as with my vue projects. It used to work fine, but now (from few previous version), components import is disabled. To clarify more,

import Vue from 'vue';
import vToastify from 'vue-toastify';

window.EventBus = new Vue();
window.flash = function (message, type) {
    let statusObject = {
        title: type + " !!!",
        type: type,
        body: message,
        defaultTitle: true
    }
    EventBus.$emit('vtNotify', statusObject);
};

Vue.component('vue-toastify', vToastify);

And blade templates would like

@if(Session::has('success'))
<script>
    window.flash("{{session('success')}}", "success");
</script>
@endif

@if(Session::has('error'))
<script>
    window.flash("{{session('error')}}", "error");
</script>
@endif
@foreach($errors->all() as $error)
<script>
    window.flash("{{$error}}", "error");
</script>
@endforeach

Basically I am importing your src/components/VueToastify.vue component in flash js and define that in a window function, which later call from my php blade file.

Problem Problem is I couldn't import that component now, and cause render error.

Solution Allow to import src/components/VueToastify.vue this component.

nandi95 commented 4 years ago

(from few previous version)

EventBus.$emit( support has long been dropped since v1 What version are you currently using?

nandi95 commented 4 years ago

Closing due to inactivity.