您的位置:首页 > Web前端 > BootStrap

bootstrap-select怎么刷新数据

2017-07-23 21:47 477 查看
    在使用bootstrap-select时,需要刷新数据。只需要调用bootstrap-select内置的方法就可以了。

说下解决思路,把option标签的内容拼接到select里面。其中 goodsName0是select标签的id。

this.dataservice.getData(this.url[0]).then(res => {
let tempData = res.rows;
let options = "<option value=''>请选择</option>";
tempData.forEach(el => {
options += "<option value='" + el.id + "'>" + el.value + "</option>";
});
return options;
}).then(options => {
$("#goodsName0").empty();
$('#goodsName0').append(options);
$('#goodsName0').selectpicker('render');
$('#goodsName0').selectpicker('refresh');
$('#goodsName0').selectpicker();
})
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐