mirror of https://github.com/layui/layui
更新 tree 测试用例
parent
db0923ac1c
commit
152ceb6e9b
|
@ -1,18 +1,10 @@
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>树组件 - layui</title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
<title>树组件 - layui</title>
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
||||||
<meta name="format-detection" content="telephone=no">
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="../src/css/layui.css" media="all">
|
<link rel="stylesheet" href="../src/css/layui.css" media="all">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
body{padding: 100px;}
|
body{padding: 100px;}
|
||||||
#test1,#test2{margin-bottom: 100px; width: 400px;}
|
#test1,#test2{margin-bottom: 100px; width: 400px;}
|
||||||
|
@ -48,118 +40,118 @@
|
||||||
|
|
||||||
//数据源
|
//数据源
|
||||||
var data1 = [{
|
var data1 = [{
|
||||||
title: '一级1'
|
title: 'A-1'
|
||||||
,id: 1
|
,id: 1
|
||||||
,children: [{
|
,children: [{
|
||||||
title: '二级1-1'
|
title: 'B-1-1'
|
||||||
,id: 3
|
,id: 3
|
||||||
,href: 'https://www.layui.com/doc/'
|
,href: 'https://www.layui.com/doc/'
|
||||||
,children: [{
|
,children: [{
|
||||||
title: '三级1-1-3'
|
title: 'C-1-1-3'
|
||||||
,id: 23
|
,id: 23
|
||||||
,children: [{
|
,children: [{
|
||||||
title: '四级1-1-3-1'
|
title: 'D-1-1-3-1'
|
||||||
,id: 24
|
,id: 24
|
||||||
,children: [{
|
,children: [{
|
||||||
title: '五级1-1-3-1-1'
|
title: 'E-1-1-3-1-1'
|
||||||
,id: 30
|
,id: 30
|
||||||
},{
|
},{
|
||||||
title: '五级1-1-3-1-2'
|
title: 'E-1-1-3-1-2'
|
||||||
,id: 31
|
,id: 31
|
||||||
}]
|
}]
|
||||||
}]
|
}]
|
||||||
},{
|
},{
|
||||||
title: '三级1-1-1'
|
title: 'C-1-1-1'
|
||||||
,id: 7
|
,id: 7
|
||||||
,checked: true
|
,checked: true
|
||||||
,children: [{
|
,children: [{
|
||||||
title: '四级1-1-1-1'
|
title: 'D-1-1-1-1'
|
||||||
,id: 15
|
,id: 15
|
||||||
//,checked: true
|
//,checked: true
|
||||||
,href: 'https://www.layui.com/doc/base/infrastructure.html'
|
,href: 'https://www.layui.com/doc/base/infrastructure.html'
|
||||||
}]
|
}]
|
||||||
},{
|
},{
|
||||||
title: '三级1-1-2'
|
title: 'C-1-1-2'
|
||||||
,id: 8
|
,id: 8
|
||||||
,children: [{
|
,children: [{
|
||||||
title: '四级1-1-2-1'
|
title: 'D-1-1-2-1'
|
||||||
,id: 32
|
,id: 32
|
||||||
}]
|
}]
|
||||||
}]
|
}]
|
||||||
},{
|
},{
|
||||||
title: '二级1-2'
|
title: 'B-1-2'
|
||||||
,id: 4
|
,id: 4
|
||||||
,spread: true
|
,spread: true
|
||||||
,children: [{
|
,children: [{
|
||||||
title: '三级1-2-1'
|
title: 'C-1-2-1'
|
||||||
,id: 9
|
,id: 9
|
||||||
,checked: true
|
,checked: true
|
||||||
,disabled: true
|
,disabled: true
|
||||||
},{
|
},{
|
||||||
title: '三级1-2-2'
|
title: 'C-1-2-2'
|
||||||
,id: 10
|
,id: 10
|
||||||
}]
|
}]
|
||||||
},{
|
},{
|
||||||
title: '二级1-3'
|
title: 'B-1-3'
|
||||||
,id: 20
|
,id: 20
|
||||||
,children: [{
|
,children: [{
|
||||||
title: '三级1-3-1'
|
title: 'C-1-3-1'
|
||||||
,id: 21
|
,id: 21
|
||||||
},{
|
},{
|
||||||
title: '三级1-3-2'
|
title: 'C-1-3-2'
|
||||||
,id: 22
|
,id: 22
|
||||||
}]
|
}]
|
||||||
}]
|
}]
|
||||||
},{
|
},{
|
||||||
title: '一级2'
|
title: 'A-2'
|
||||||
,id: 2
|
,id: 2
|
||||||
,spread: true
|
,spread: true
|
||||||
,children: [{
|
,children: [{
|
||||||
title: '二级2-1'
|
title: 'B-2-1'
|
||||||
,id: 5
|
,id: 5
|
||||||
,spread: true
|
,spread: true
|
||||||
,children: [{
|
,children: [{
|
||||||
title: '三级2-1-1'
|
title: 'C-2-1-1'
|
||||||
,id: 11
|
,id: 11
|
||||||
},{
|
},{
|
||||||
title: '三级2-1-2'
|
title: 'C-2-1-2'
|
||||||
,id: 12
|
,id: 12
|
||||||
}]
|
}]
|
||||||
},{
|
},{
|
||||||
title: '二级2-2'
|
title: 'B-2-2'
|
||||||
,id: 6
|
,id: 6
|
||||||
,checked: true
|
,checked: true
|
||||||
,children: [{
|
,children: [{
|
||||||
title: '三级2-2-1'
|
title: 'C-2-2-1'
|
||||||
,id: 13
|
,id: 13
|
||||||
},{
|
},{
|
||||||
title: '三级2-2-2'
|
title: 'C-2-2-2'
|
||||||
,id: 14
|
,id: 14
|
||||||
,disabled: true
|
,disabled: true
|
||||||
}]
|
}]
|
||||||
}]
|
}]
|
||||||
},{
|
},{
|
||||||
title: '一级3'
|
title: 'A-3'
|
||||||
,id: 16
|
,id: 16
|
||||||
,children: [{
|
,children: [{
|
||||||
title: '二级3-1'
|
title: 'B-3-1'
|
||||||
,id: 17
|
,id: 17
|
||||||
,fixed: true
|
,fixed: true
|
||||||
,children: [{
|
,children: [{
|
||||||
title: '三级3-1-1'
|
title: 'C-3-1-1'
|
||||||
,id: 18
|
,id: 18
|
||||||
},{
|
},{
|
||||||
title: '三级3-1-2'
|
title: 'C-3-1-2'
|
||||||
,id: 19
|
,id: 19
|
||||||
}]
|
}]
|
||||||
},{
|
},{
|
||||||
title: '二级3-2'
|
title: 'B-3-2'
|
||||||
,id: 27
|
,id: 27
|
||||||
,children: [{
|
,children: [{
|
||||||
title: '三级3-2-1'
|
title: 'C-3-2-1'
|
||||||
,id: 28
|
,id: 28
|
||||||
},{
|
},{
|
||||||
title: '三级3-2-2'
|
title: 'C-3-2-2'
|
||||||
,id: 29
|
,id: 29
|
||||||
}]
|
}]
|
||||||
}]
|
}]
|
||||||
|
@ -222,7 +214,7 @@
|
||||||
console.log(checkedData);
|
console.log(checkedData);
|
||||||
}
|
}
|
||||||
,setChecked: function(){
|
,setChecked: function(){
|
||||||
tree.setChecked('demoId1', [1000, 1001, 1002]);
|
tree.setChecked('demoId1', [11,12]);
|
||||||
}
|
}
|
||||||
,reload: function(){
|
,reload: function(){
|
||||||
tree.reload('demoId1', {
|
tree.reload('demoId1', {
|
||||||
|
|
Loading…
Reference in New Issue