折腾很久才解决问题
$.ajax({ url: '@Url.Action("GetSystemSzzdItem", "CangpinGushi")', type:"Post", dataType: 'json', async:false, success: function (data) { $("#gszt").select2({ placeholder: "故事主题", data: data, cache: true }); $('#gszt').val(['1803285504500039']).trigger('change'); //[] 这里是value 值 } });
多选复制情况
var arr = ['1803285504500039','1803285504500040','1803285504500041'];
$('#select1').val(arr).trigger('change');
参考:https://blog.csdn.net/shu580231/article/details/76218942