xm-select jquery插件,多选下拉框单选下拉框

曹え 5811 发布于:2022-04-22 09:17:31

文档:https://maplemei.gitee.io/xm-select/#/component/install


gitee : https://toscode.gitee.com/maplemei/xm-select


image.png


使用方法:


引入js

<script src="js/xm-select.js"></script>


html

<input type="hidden" id="jzuid" />    
		<div id="selectDemo" class="xm-select-demo" style="width: 300px;"></div>


js

$(function() {    
					xmSelect.render({    
				el: '#selectDemo',    
				checkbox: true,    
				repeat: false,    
				autoRow: true,    
				filterable: true,    
				prop: {name: 'name', value: 'value',},    
				height: '200px',    
				tips: '请选择兼职技术',    
				radio: true,    // 是否为单选
				tree: {    
				show: true,    
				showFolderIcon: true,    
				showLine: true,    
				indent: 20,    
				expandedKeys: [-3],    
				strict: false,    
				},    
				data: function () {    
				return [{"name":"小王","value":"1461"},{"name":"小张","value":"1461"}];    
				},    
				// 选择后的回调函数,获得选择的值数组
				on: function (data) {    
				var arr = data.arr;//arr:  当前多选已选中的数据    
				console.log(arr[0].value)    
					v = arr[0].value    
					('#jzuid').val(v)    
				},    
				});    
								    
	 		});


觉得有用请点个赞吧!
1 1354