Vue Js 2 Component Selector

Posted on  by admin
Modified9 months ago. My component vue is like this :.

I use this : to selected.

But whene executed, on the gulp watch exist error. The error like this :. ERROR in ./~/vue-loader/lib/template-compiler.js?id=data-v-53777228!/~/vue-load er/lib/selector.js?type=template&index=0!/resources/assets/js/components/bootst rap/LocationBsSelect.vue Module build failed: SyntaxError: Unexpected token (28:4).

Seems my step is wrong. How can I solve it? 5151 bronze badges. 6,1961919 gold badges6464 silver badges101101 bronze badges.

6464 silver badges101101 bronze badges. You are binding properties to nothing. and :selected in. If you set the code like so, your errors should be gone:. you would now need to have a data property called selected so that v-model works.

If that seems like too much work, you can also do it like:.
Adam ZernerAdam Zerner

55 gold badges3636 silver badges5151 bronze badges. 5151 bronze badges. The simplest answer is to set the selected option to true or false. Where the data object is:.

This is an example to set the selected month day:. On your data set:. 4646 bronze badges. Here "challan.warehouse_id" come from "challan" object you get from:. 4545 bronze badges. 47622 gold badges55 silver badges1818 bronze badges. 55 silver badges1818 bronze badges.

You simply need to remove v-bind (:) from selected and required attributes.Like this :-.

You are not binding anything to the vue instance through these attributes thats why it is giving error. Aafiya HanafiAafiya Hanafi. Another way, which I often find more reliable, is you could add a directive to your app.js or wherever you are initiating your VueJS, eg:.

Roy JRoy J

My code for reactive multiselect. Selected items are binded to the article.categoriesIds array.

99 gold badges4242 silver badges8181 bronze badges.

Not the answer you're looking for? Browse other questions tagged vue.jsvue-component or ask your own question.