using Vuejs/Laravel .I use this simple javascript code to generate a chart in blade.
<script>
function getData(columnOrder, keyName) {
var obj, table = $("#t4"), array = [];
table.find('tbody tr').each(function() {
var rows = $(this).find('td:nth-child(' + columnOrder +')');
rows.each(function(){
obj = {};
obj[keyName] = $(this).text();
array.push(obj);
});
});
return array;
}
var categories = getData(1, 'label');
var datas = getData(2, 'value');
console.log(categories);
console.log(datas);
It works when my html table contain html/php values. but when it's vuejs values, it's seems not recognizing data.. Here is my table with vuejs.
<table class="hidden" id="t4">
<thead>
<tr>
<th scope="col">a</th>
<th scope="col">b</th>
</tr>
</thead>
<tbody>
<template v-for="person in personsWithAmount">
<tr>
<td scope="row" >@{{person.user.name}}</td>
<td scope="row">@{{person.totalAmount}}</td>
</tr>
</template>
</tbody>
</table>
Console.log still blank Thank you in advance