Vue项目中重置Select的选中状态
2020-05-12 本文已影响0人
被饿死的小智啦
重置方法
mounted: function() {
document.getElementById("type-select").options.selectedIndex = 0; //回到初始状态
$("#type-select").selectpicker("refresh"); //对type-select这个下拉框进行重置刷新
}
另外一种方式
mounted: function() {
setTimeout(() => {
if (document.getElementById("type-select").options[0].selected != true) {
location.reload();
}
}, 100);
}