I can not install vue-toasted by Vue.use (2019)

854 Views Asked by At

I am using Vue 2.6.10 and vue-toasted 1.1.27. But, I got a error from browser. Why I can't install vue-toasted? vue-toasted is not supported Vue 2.6.10?

import Toasted from 'vue-toasted';
Vue.use(Toasted);
vue-toasted.min.js:1 Uncaught TypeError: Cannot read property 'appendChild' of null
    at l (vue-toasted.min.js:1)
    at new t (vue-toasted.min.js:1)
    at Object.install (vue-toasted.min.js:1)
    at Function.Vue.use (vue.common.dev.js:5090)
    at eval (main.js:25)
    at Module../src/app/main.js (main-b2fe359a90a55c61424d.js:765)
    at __webpack_require__ (main-b2fe359a90a55c61424d.js:20)
    at main-b2fe359a90a55c61424d.js:84
    at main-b2fe359a90a55c61424d.js:87
1

There are 1 best solutions below

0
On

Use:

import Toasted from 'vue-toasted';
window.addEventListener('load', () => {
    Vue.use(Toasted);
});