From bca646a1adfc519a8753fe63c6f27aea94c442a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Sun, 19 Sep 2021 06:11:54 +0200 Subject: [PATCH] vue demo avoid readAsBinaryString [ci skip] --- demos/vue/Makefile | 3 ++- demos/vue/pages/index.vue | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/demos/vue/Makefile b/demos/vue/Makefile index c6f5418..70db57f 100644 --- a/demos/vue/Makefile +++ b/demos/vue/Makefile @@ -6,7 +6,8 @@ vue: ## Simple server for vue nuxt: ## nuxt.js demo mkdir -p node_modules cd node_modules; if [ ! -e xlsx ]; then ln -s ../../../ xlsx; fi; cd .. - nuxt + npm i nuxt vue + npx nuxt .PHONY: weex weex: ## Build weex project diff --git a/demos/vue/pages/index.vue b/demos/vue/pages/index.vue index 0dedc48..864c14a 100644 --- a/demos/vue/pages/index.vue +++ b/demos/vue/pages/index.vue @@ -74,8 +74,8 @@ export default { const reader = new FileReader(); reader.onload = (e) => { /* Parse data */ - const bstr = e.target.result; - const wb = XLSX.read(bstr, {type:'binary'}); + const ab = e.target.result; + const wb = XLSX.read(new Uint8Array(ab), {type:'array'}); /* Get first worksheet */ const wsname = wb.SheetNames[0]; const ws = wb.Sheets[wsname]; @@ -85,7 +85,7 @@ export default { this.data = data; this.cols = make_cols(ws['!ref']); }; - reader.readAsBinaryString(file); + reader.readAsArrayBuffer(file); } } };