yuche / vue-strap

Bootstrap components built with Vue.js
http://yuche.github.io/vue-strap/
MIT License
4.71k stars 932 forks source link

Uncaught TypeError: Cannot read property 'classList' of undefined #452

Closed appdrops closed 6 years ago

appdrops commented 7 years ago

I'm not sure what classList refers to but I couldn't get it to work. I ended up removing the if statement below and it worked fine.

daySelect (date, el) { if (el.$el.classList[0] === 'datepicker-item-disable') { return false } else { this.currDate = date this.value = this.stringify(this.currDate) this.displayDayView = false } },

Tyree commented 7 years ago

I'm having the same problem. I was hoping to get some help on it. Oh well...

Thibzzz commented 7 years ago

So I hotfixed this bug on my machine : Datepicker.vue - line22, fix event handling : <span v-for="d in dateRange" :class="d.sclass" @click="daySelect(d.date,$event)">{{d.text}}</span> Datepicker.vue - line 188, access element classlist properly : if (el.target.classList[0] === 'datepicker-item-disable') {

There's still a warning because props are mutated directly but it works. I have to move on but i'll try to fix the warning too. Then maybe do a commit here.

Tyree commented 7 years ago

Thanks, @Thibzzz!

NewbMiao commented 7 years ago

still have this problem,and report warn

Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "value"
Thibzzz commented 7 years ago

Yeah two way binding with sync is essentially dead on Vue2 with .sync deprecation (which this component relies on). So any component relying on .sync in Vue 2.0 + is now compromised. I fixed the problem locally by adding an external variable as a props to modify with v-model and removed .sync all together. I suggest you do the same. Bluntly resumed : sync is dead so this won't work anymore. -> https://forum-archive.vuejs.org/topic/4288/best-practices-to-replace-sync/4

PavloAndriiesh commented 7 years ago

Hi guys. Is there any information about fixing this issue?

Agnius commented 7 years ago

I have same problem so far.

codexp commented 7 years ago

me too and it seems like it's an old bug that is still open very sad