csv
利用javaScript 在客戶端把數(shù)據(jù)轉(zhuǎn)換成csv格式并導(dǎo)出到本地
非本人寫的js乎串,只是一個(gè)簡單教程步藕,還請多多指教。
demo地址:CSV demo
csv格式
第一行為頭部,其他為數(shù)據(jù)部分丈甸,數(shù)據(jù)與數(shù)據(jù)之間用逗號隔開,換行為一組數(shù)據(jù)
"id","number","string","smile"
"11","111","ssd","嘿嘿"
"22","222","kk","哈哈"
"33","333","sf","呵呵"
步驟
第一步:把數(shù)據(jù)轉(zhuǎn)義成csv格式
我使用了其他人寫的js來生成csv格式爱榔,具體使用方法可參考: https://github.com/knrz/CSV.js
如覺得太笨重挟伙,可自行生成。
第二步:觸發(fā)客戶端生成csv文件并導(dǎo)出到本地
Build Setup
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report