I have a page for listing data from table using Vue.js and Laravel. Listing data is successful. Delete and edit function is going on. For that purpose I have added two
If using Typescript Vue class components, install the jquery types:
npm install --save @types/jquery
And declare the directive like this in your Vue file, outside your component:
Vue.directive('tooltip', function(el, binding) {
($(el) as any).tooltip({
title: binding.value,
placement: binding.arg,
trigger: 'hover'
})
});
Then use the sample HTML/bindings from @Ikbel's answer.
You need to run $('[data-toggle="tooltip"]').tooltip()
AFTER the data loads from the server. To ensure the DOM is updated, you can use the nextTick
function:
fetchTaskList: function(){
this.$http.get('/backend/religion/data', function(tasks){
this.$set('list', tasks);
Vue.nextTick(function () {
$('[data-toggle="tooltip"]').tooltip()
})
});
}
https://vuejs.org/api/#Vue-nextTick
Edit: a more complete and robust solution has been posted by Vitim.us below