function newSelect(id,saveId) { xmSelect.render({ el: '#'+id, checkbox: true, repeat: false, autoRow: true, filterable: true, prop: { name: 'name', value: 'value' }, height: '200px', tips: '请选择', // 默认选中的value initValue: ['4','5'], tree: { show: true, showFolderIcon: true, showLine: true, indent: 20, expandedKeys: [-3], strict: false, }, data: function () { return [{name:'张三',value:'0'}, {name:'李四',value:'1',disabled:"disabled"}, {name:'王五',value:'2'}, {name:'马六',value:'3'}, {name:'赵四',value:'4'},{name:'王二默认?',value:'5'}] ; }, on: function (data) { var arr = data.arr;//arr: 当前多选已选中的数据 console.log(data) let _r = [] arr.forEach(item => { _r.push(item.value) }) console.log(_r.join(',')) $('#'+saveId).val(_r.join(',')) }, }); }
在initValue中加
标签:arr,name,xm,data,value,js,选中,true,select From: https://www.cnblogs.com/mingluxy/p/18230144