Dismiss
Announcing Stack Overflow Documentation

We started with Q&A. Technical documentation is next, and we need your help.

Whether you're a beginner or an experienced developer, you can contribute.

Sign up and start helping → Learn more about Documentation →

Have problem with handle even @click to the div class="fileInfo" What am I doing wrong ?

   var InfoComponent = Vue.extend({                                                                                                                                                                                
  template:'<div> {{{component}}} </div>',                                            
  data:function(){
   return{
      infoContent:'',
      component:''                                                                  
    } 
  },       
  methods:{
    createInfoElem:function(){                                                      
      this.component = "<div class='fileInfo'  @click='removeInfoElem'>X</div>"
   },        
   removeInfoElem:function(){                                                      
      console.log('removed');                                                       
   },        
  }            

})

share|improve this question
    
you don't provde enough information to really say much. But you seem to try and create new DOM elements manually with your own template string (though you don't show how you do that) - that won't work with Vue. Vue will not parse v-* directives etc. in manually created DOM. – Linus Borg Jun 11 at 21:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.