DonNicoJs / vue-xlsx

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

Problem with $slotOptions and dwonload button #9

Open heitara opened 4 years ago

heitara commented 4 years ago

Hello,

I had some problem with the most recent version - "vue-xlsx": "^0.2.1" The Download button is not appearing. I've updated the render function with this new one and it seems to be working.

render(h) {
    if (this.$slots.default && this.loaded) {
      return h(
        "div",
        {
          on: {
            click: this.disableWrapperClick ? () => {} : this.download
          }
        },
        [
          this.$slots.default
        ]
      );
    }
    return null;
  }

Here is the old function for comparison:

  render(h) {
    if (this.$scopedSlots.default && this.loaded) {
      return h(
        "div",
        {
          on: {
            click: this.disableWrapperClick ? () => {} : this.download
          }
        },
        [
          this.$scopedSlots.default({
            download: this.download
          })
        ]
      );
    }
    return null;
  }

I'm not sure why $scopedSlots. is undefined. Could you please adjust the code, so it works fine on Vue@2.5.17?

DonNicoJs commented 4 years ago

@heitara Thank you for the issue, I will take a look ASAP!

heitara commented 4 years ago

You can check my fork. I’ll send a PR.

Sent from my iPhone

On Apr 26, 2020, at 18:35, Nicolò Maria Mezzopera notifications@github.com wrote:

 @heitara Thank you for the issue, I will take a look ASAP!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.