VueJS未知自定义元素:您是否正确注册了组件

时间:2019-01-07 14:34:10

标签: javascript vue.js vuejs2

我想在我的VueJS应用中使用这个第三方toast组件,但是它给出了错误,

Unknown custom element: <toast-container> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

main.ts

import VueOnToast from 'vue-on-toast';
..
Vue.use(BootstrapVue, Vuex, VueOnToast);

App.vue

<toast-container></toast-container>

1 个答案:

答案 0 :(得分:6)

请参阅Vue.use的签名:

Vue.use( plugin )

Vue.use仅需要一个参数。如果您通过的次数过多,它们将被忽略。

您必须像这样使用它:

Vue.use(BootstrapVue);
Vue.use(Vuex);
Vue.use(VueOnToast);
相关问题