2017-01-26 4 views
0

일부 vuejs 이벤트가 있습니다.Vuejs 아약스 콘텐츠 지연 이벤트

<div @mouseover="activate" @mouseout="deactivate" class="item featured"> 

잘 작동하지만 콘텐츠가 간단한 jquery load()를 통해로드되면 트리거되지 않습니다. 어떻게 vuejs에서 이러한 이벤트를 연기 할 수 있습니까?

편집 :

부하가 당신은 dynamic class binding은 VUE에 의해 제공 사용할 수 있습니다, 당신은 요소에 동적으로 클래스를 추가 할 것을 감안할 때 탐색

<li v-on:click="filterTalents" data-department="hardware"> 




filterTalents: function(event) { 
     var dept= $(event.target).closest('li').data('department'); 
     $(".content").load("includes/"+dept+".html", function() 

}); 

     }, 

     activate: function(event) { 
     $(event.target).closest('.item').addClass('active'); 

     }, 

     deactivate: function(event) { 
     $(event.target).closest('.item').removeClass('active'); 

     }, 
+0

jquery'.load()'가 어디에 사용되는지 확인해야합니다. –

+0

다른 vuejs 메서드에서 단추에서 데이터를 가져 와서로드합니다. – LeBlaireau

답변

0

을 클릭하여 실행됩니다.

간단한 예 동적 클래스 전환 v-bind:class에 객체를 전달하는 것 :

<div v-bind:class="{ active: isActive }"></div> 

상기 구문 데이터 등록이 isActive의 truthiness 의해 결정될 것이다 활성 클래스의 존재를 의미한다.