Javascript Vue组件未呈现Vue通知
我正在使用这个库: 上面页面上的文档说明:Javascript Vue组件未呈现Vue通知,javascript,vue.js,vuejs2,vue-component,Javascript,Vue.js,Vuejs2,Vue Component,我正在使用这个库: 上面页面上的文档说明:组件:{//是呈现的,而不是通知消息,因此我尝试为其提供动态组件,以便处理自定义事件。这是我的代码: Vue.use(vueNotifyjs) new Vue({ el: '#app', methods: { addNotification(verticalAlign = 'top', horizontalAlign = 'right') { this.$notify({ component: functio
组件:{//是呈现的,而不是通知消息
,因此我尝试为其提供动态组件,以便处理自定义事件。这是我的代码:
Vue.use(vueNotifyjs)
new Vue({
el: '#app',
methods: {
addNotification(verticalAlign = 'top', horizontalAlign = 'right') {
this.$notify({
component: function(){
return {
template: '<h1>Hello</h1>'
};
},
horizontalAlign: horizontalAlign,
verticalAlign: verticalAlign,
type: "success"
})
}
}
})
Vue.use(vueNotifyjs)
新Vue({
el:“#应用程序”,
方法:{
addNotification(垂直对齐='top',水平对齐='right'){
这是$notify({
组件:函数(){
返回{
模板:“你好”
};
},
水平对齐:水平对齐,
垂直排列:垂直排列,
类型:“成功”
})
}
}
})
这是我的JSFIDLE:
但是notify中没有呈现单词
Hello
。知道我缺少什么吗?我认为组件键应该是有一个Vue组件实例。
在您的场景中,创建一个vue组件,如下所示
Vue.component('custom-message'{
模板:`你好,世界`
})
我已经修改了小提琴与上述在这方面
希望能有帮助