P粉6161110382023-09-04 16:19:58
I see a lot of stuff, to answer your question clearly, v-for is used on elements.
<template> // For mor readability i recommend you do bind your property: // - name={{selector_name}} become :name="selector_name" <select :name="selector_name" class= "combobox" :id="selector_id"> <!-- v-for is required with a unique key, you can take the index and use it --> <option v-for="(opt, index) in selector_options" :key="`opt ${index}`" value=opt> {{ opt }} </option> </select> </template>
You cannot define props and data with the same name. Props, inject properties and values into the data. Exactly the same, but the data comes from the parent and you pass values from the parent to the child.
So if you need to pass data, use props, but don't define it inside the data.
There is a working example of all of this (I'm using data instead of props to improve readability). < /p>