DonNicoJs / vue-xlsx

XLSX manipulation made easy by Vue.js
https://vue-xlsx.netlify.com/
MIT License
40 stars 37 forks source link

Mocha testing fail #14

Open Co0olCat opened 4 years ago

Co0olCat commented 4 years ago

Hi,

First of all, thank you - great job.

Issue: When testing with Mocha -> error:: TypeError: Cannot set property '0' of undefined

Proposed solution: In your vue component file using vue-xlsx add "import Xlsx from 'xlsx';"

This is snippet from my vue file:

...
<script>

    import {
        XlsxRead,
        XlsxJson,
        XlsxSheets
    } from 'vue-xlsx';

    import Xlsx from 'xlsx';

    export default {
        components: {
            XlsxRead,
            XlsxJson,
            XlsxSheets
        },
        data() {
            return {
                file: null,
                selectedSheet: null,
                selectedData: null
            };
        },
...

Thank you.

Issue is closed.