Why vue dumps warn error although everything is working correctly?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
23 views
I have such a component.
This is accordion with checkboxes (unnecessary code I removed for brevity)
Vue = require 'vue/dist/vue.js'checkordion = Vue.component "checkordion",props: ['columns']data: ->returnspoilers: [{shown: false}]isDataSet: falsemethods:toggleSpoilers: (key) ->that = thisthat.spoilers.forEach (spoiler, index) ->if index == keyif spoiler.shownspoiler.shown = falseelsespoiler.shown = trueelsespoiler.shown = falsesetInnerCheckboxes: (type, value) ->this.columns.array.forEach (item, index) ->if type == item.typeitem.visible = valueupdated: ->that = thisif !this.isDataSetObject.keys(this.columns.categories).forEach (key) ->spoiler = {shown: false}that.spoilers.push spoilerthat.isDataSet = truemodule.exports = checkordion{{category.label}}


He gets props object with two arrays of category checkboxes, which I get amount of spoilers accordion, and an array of objects checkboxes.
Opens and closes properly everything works correctly, but when I render there is a bug in :class="{'checkordion__section--opened': spoilers[key].shown}" the fact that the propetry spoilers[key].shown of undefined Why are undefined... I don't really understand.
Wrote several hooks. mounted - spoilers[0].shown available. created - available, updated, available, beforeUpdate available. key in the template is available.
Why Vue swears?
by | 23 views

1 Answer

0 like 0 dislike
You can check to add:
{'checkordion__section--opened': spoilers & the spoilers[key].shown}
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
110,608 questions
257,187 answers
0 comments
40,796 users