layui树形结构下拉框

时间:2025-04-02 15:56:26
  • var departmentTree = xmSelect.render({
  • el: '#departmentId',
  • name: 'departmentId',
  • clickClose: true,
  • direction: 'down',
  • radio: true,
  • toolbar: {
  • show: true,
  • },
  • filterable: true,
  • language: 'zn',
  • data: [],
  • tips: '请选择部门',
  • tree: {
  • show: true,
  • simple: true,
  • strict: false,
  • },
  • prop:{
  • //子节点的名称
  • children:'child',
  • value: 'id'
  • }
  • });
  • //接口
  • layui.$.get("/back/department/list", {}, result => {
  • if ( === 0) {
  • departmentTree.update({
  • data: ,
  • autoRow: true,
  • });
  • }
  • }, 'json');