Need to use excel as a part of an input form in my quasar app. The goal is to resolve this problem, or propose a alternative integration that has proven to work.
What have I done:
- Instal "vue-excel-editor" package, by running:
npm install vue-excel-editor
- Add below code to quasar.conf.js:
boot: [
'...',
'...',
'vue-excel-editor'
],
- Add below code to created /boot/vue-excel-editor.js
import { boot } from 'quasar/wrappers'
import VueExcelEditor from 'vue-excel-editor'
export default boot(({ app }) => {
// Set VueExcelEditor instance on app
app.use(VueExcelEditor)
})
export { VueExcelEditor }
acc to info from vue-excel-editor ducumentation please see here: https://www.npmjs.com/package/vue-excel-editor
- Created a basic component just for checking:
<template>
<vue-excel-editor v-model="jsondata" filter-row>
<vue-excel-column field="user" label="User ID" type="string" width="80px" />
<vue-excel-column field="name" label="Name" type="string" width="150px" />
<vue-excel-column
field="phone"
label="Contact"
type="string"
width="130px"
/>
<vue-excel-column
field="gender"
label="Gender"
type="select"
width="50px"
:options="['F', 'M', 'U']"
/>
<vue-excel-column field="age" label="Age" type="number" width="70px" />
<vue-excel-column
field="birth"
label="Date Of Birth"
type="date"
width="80px"
/>
</vue-excel-editor>
</template>
<script>
export default {
name: "Spreadsheet",
};
</script>
And after adding this component to previously working page I'm getting this console:
App • ERROR • UI in ./node_modules/vue-excel-editor/src/VueExcelEditor.vue?vue&type=template&id=cf2e49d2&scoped=true
Module Error (from ./node_modules/vue-loader/dist/templateLoader.js):
VueCompilerError: <template v-for> key should be placed on the <template> tag.
at C:\Users\..\..\..\Code\..\frontend\node_modules\vue-excel-editor\src\VueExcelEditor.vue:124:21
122| }"
123| :style="Object.assign(cellStyle(record, item), renderColumnCellStyle(item))"
124| :key="p"
| ^^^^^^^^
125| @mouseover="cellMouseOver"
126| @mousemove="cellMouseMove">{{ item.toText(record[item.name]) }}</td>
App • ERROR • UI in ./node_modules/vue-excel-editor/src/VueExcelEditor.vue?vue&type=template&id=cf2e49d2&scoped=true
Module Error (from ./node_modules/vue-loader/dist/templateLoader.js):
VueCompilerError: <template v-for> key should be placed on the <template> tag.
at C:\..\..\..\..\Code\..\frontend\node_modules\vue-excel-editor\src\VueExcelEditor.vue:144:21
142| }"
143| :style="renderColumnCellStyle(field)"
144| :key="`f${p}`">{{ summary[field.name] }}</td>
| ^^^^^^^^^^^^^^
145| </template>
146| </tr>
App • COMPILATION FAILED • Please check the log above for details.