0

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:

  1. Instal "vue-excel-editor" package, by running:
npm install vue-excel-editor
  1. Add below code to quasar.conf.js:
boot: [
  '...',
  '...',
  'vue-excel-editor'
],
  1. 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

  1. 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.

2 Answers 2

1

Are you using Vue 3.0? Now vue-excel-editor component is only for Vue 2.0.

https://v3-migration.vuejs.org/breaking-changes/key-attribute.html#with-template-v-for

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for feedback, I'm using "quasar": "^2.1.1" so it should be based on vue 3.0. Any plans for making it compatible with 3.0?
0

There is a version of Vue Excel Editor for Vue 3 available on https://github.com/cscan/vue3-excel-editor. This should resolve your problem above.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.