xm-select简单使用一例

HTML

<div id="admin_ids" class="xm-select-demo"></div>

<script src="/Public/js/xm-select.js"></script>
<script>
	var admin_ids = xmSelect.render({
		el: '#admin_ids'
		, filterable: true
		, tips: '请选择用户'
		, theme: { color: '#558ff5' }
		, data: []
	})
	$.getJSON('__MODULE__/Admin/ajax_group_list', function (res) {
		admin_ids.update({ data: res.data.list })
	})

	form.on("submit(*)", function (e) {
		var data = e.field
		data.admin_ids = admin_ids.getValue().map(i => i.value).join(',')
		console.log(data)
		table.reload('tb', { where: data })
		return false
	})
</script>

<style>
	.xm-select-demo {
		vertical-align: top;
		display: inline-block;
		width: 300px;
	}
</style>

posted on 2022-10-08 10:50  小馬過河﹎  阅读(553)  评论(0)    收藏  举报

导航