Closed lizhi2013 closed 8 years ago
What's the point if you already work with data in a json? There are already a lot of json to csv converters out there. http://konklone.io/json/
@lizhi2013 Nope, it cannot. As @gurghet has suggested, I think there are other libraries that can do just that. :)
I realize this is a closed issue, but I thought I'd comment on my solution so others can gain from it. It's likely you already have a JSON dataset in the local browser that you want to convert into a csv file that the browser will prompt the user to save. Below accomplishes that goal.
methods: {
csvExport: function (users) {
var csvContent = "data:text/csv;charset=utf-8,";
csvContent += this.users.map(function(d){
console.log(d);
return JSON.stringify(d);
})
.join('\n')
.replace(/(^\{)|(\}$)/mg, '');
window.open( encodeURI(csvContent) );
}
}
vuetable can export out the data into excel or csv?