2 Star 1 Fork 2

tkgl / combotree

forked from Allen / combotree 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

combotree

介绍

基于layui及zTree的树下拉框组件,把zTree也封装成了layui的模块,无需另外引用,下来面板改为追加到body,防止某种情况下被遮挡

软件架构

在基于Layui开发后台管理系统时,想要一个下拉树控件控件,在网上找了一些开源的实现,都不是太满意,于是自己动手基于Layui 2.8.x及zTree 3.5.x制作了一个下拉树控件。由于本人是一个后端程序员,且对layui也不熟悉,所以只是实现了一个能用的版本,并不完善,有问题请自行修改或提出修改方案。

例子截图

输入图片说明

安装教程

下载layztree目录和combotree.js文件放在web工程的js相关文件static目录即可。

使用说明

// 配置
layui.config({
  base: getCtxPath() + '/lib/extends/' // 假设这是存放拓展模块的根目录
}).extend({
  layztree: 'layztree/layztree', //combotree需要引用layztree
  combotree: 'combotree'
});

layui.use(['layztree','combotree'],function() {
  var layztree = layui.layztree;
  var combotree = layui.combotree;
  // 渲染
  combotree.render({
    elem: '#elementId'
    ,placeholder: '请选择'
    ,isMultiple: false    // 是否多选,默认是单选
    ,yChkboxType: 'ps'    // 参考zTree该参数
    ,nChkboxType: 'ps'    // 参考zTree该参数
    ,expandLevel: '2'     // 默认展开的层级
    ,ajaxUrl: '/xxxxx'    // 取得树数据的url
    ,readonly: false      // 是否只读模式
    ,layVerify: 'required' // 是否是必选项目
    ,initValue: '100'      // 初期选中值,该值为树节点数据的ID,多个的时候以逗号分隔
    ,callback: {
      layonClick: function (event, treeId, treeNode) {
        //点击后打算做什么
      },
      layonCheck: function (event, treeId, treeNode) {
        //选中后打算做什么
      },
    }
  });  

})

参与贡献

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request
MIT License Copyright (c) 2023 Allen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

基于layui及zTree的树下拉框组件 展开 收起
JavaScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/tkgl/combotree.git
git@gitee.com:tkgl/combotree.git
tkgl
combotree
combotree
master

搜索帮助