[英]Loading bootstrap-multiselect dynamically in vueJs loop
I'm trying to load dynamically bootstrap-multiselect in VueJs loop. 我正在尝试在VueJs循环中动态加载bootstrap-multiselect。
I want to do something like this: 我想做这样的事情:
<div class="col-xs-6 col-sm-4 mb-1" v-for="params in param">
<select class="mult" multiple="multiple">
<option value="cheese">Cheese</option>
<option value="tomatoes">Tomatoes</option>
</select>
</div>
but it does not load correctly Check this out jsfiddle 但它不能正确加载检查这个jsfiddle
Please, i need advice. 请,我需要建议。
Try this: 尝试这个:
http://jsfiddle.net/Lw5us5y3/5/ http://jsfiddle.net/Lw5us5y3/5/
I'm calling the refresh method of multiselect after the updated vue lifecycle. 在更新的vue生命周期之后,我将调用multiselect的refresh方法。
$(function() { $('.mult').multiselect(); }); new Vue({ el: '#app', data: { params: '', message: 'Test' }, methods: { load: function() { this.params = [{value: 'cheese'}, {value: 'tomatoes'}] } }, updated: function(){ $('.mult').multiselect('refresh'); } })
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.