I have something like the following code :
<select>
<option v-for="category in step4.categoryList" v-on:click="setCategoryId(category.id)">
@{{category.category_name }}
</option>
</select>
It works fine in firefox but doesn't work in chrome and safari. in other words @click doesn't work in chrome when it's in an option tag.
It's obvious that I'm using vuejs.
any idea?
I have something like the following code :
<select>
<option v-for="category in step4.categoryList" v-on:click="setCategoryId(category.id)">
@{{category.category_name }}
</option>
</select>
It works fine in firefox but doesn't work in chrome and safari. in other words @click doesn't work in chrome when it's in an option tag.
It's obvious that I'm using vuejs.
any idea?
Share Improve this question edited Jul 4, 2018 at 20:14 Derek Pollard 7,1756 gold badges43 silver badges60 bronze badges asked Jul 4, 2018 at 19:04 blank94blank94 3945 silver badges21 bronze badges1 Answer
Reset to default 8Click event on option tag is not supposed to fire at all. Don't rely on it. Bind onchange event on select:
<select v-on:change="setCategoryId">
<option
v-for="category in step4.categoryList"
:value="category.id">
@{{category.category_name }}
</option>
</select>
Then in setCategoryId
take event.target.value
, it will be your id.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745132563a4613043.html
评论列表(0条)