gritcode / gritcode-components

Custom components based on Vuestrap.
http://gritcode.github.io/gritcode-components/#/toast
MIT License
204 stars 9 forks source link

Props not taking effect on Toast. #10

Open johnRivs opened 8 years ago

johnRivs commented 8 years ago

I decided to use the Toast component, but because I'm using browserify, I had to put the files together myself. I chose to use .vue files and it worked fine.

However, I ended up looking at the code and noticed how props dont actually take effect when the Toast is triggered:

  1. An event (show::toast) gets triggered with some options.
  2. addToQueue(options) gets called.
  3. show(options) gets called.
  4. show() overrides the props with these options, but if there are none, instead of using the props it will use some defaults.

So basically, instead of

this.duration = options.duration || this.duration;

the component does

this.duration = options.duration || DURATION;

Which means, <vs-toast :duration="1000"></vs-toast> is doing nothing. It's still 6 seconds by default.

kzima commented 8 years ago

@johnRivs Yeah, there could be a bug there. Would u mind creating pull request for that?

johnRivs commented 8 years ago

Mmm, I'll see if I can get around to it.

Let's say the priority would be:

  1. Options passed to the event.
  2. Props on <vs-toast>.
  3. Defaults defined in the component.

Sounds good?

kzima commented 8 years ago

Excellent!