2017-11-18 8 views
0

VUE는-통지 렌더링하지 : https://github.com/cristijora/vue-notifyjs뷰 구성 요소는 내가이 라이브러리를 사용하고

위의 페이지 상태에서 문서 : component: { //is rendered instead of notification message 따라서 나는 사용자 정의 이벤트를 처리 할 수 ​​있도록 그것을 동적 구성 요소를 제공하기 위해 노력하고 있습니다. 이건 내 코드입니다 :

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" 
     }) 
    } 
    } 
}) 

이 내 jsfiddle입니다 : https://jsfiddle.net/z11fe07p/2706/

그러나 단어 Hello이 통지에서 렌더링지고 있지 않습니다. 어떤 아이디어가 누락 되었습니까?

답변

1

구성 요소 키에는 Vue 구성 요소의 인스턴스가 있어야한다고 생각합니다.

Vue.component('custom-message',{ template:`<div>Hello World</div>` })

내가이 link의 위의와 바이올린을 수정 한 다음 은 시나리오에서 VUE 구성 요소를 만들 수 있습니다.

희망 하시겠습니까?

+0

멋진 bhai. 고맙습니다. –