Skip to content

Commit 9a3d5ae

Browse files
committed
完善cc-dropdown
1 parent d9157c9 commit 9a3d5ae

File tree

3 files changed

+26
-22
lines changed

3 files changed

+26
-22
lines changed

.idea/workspace.xml

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/command-component/cmd-cmt.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,12 @@ define([''], function (){
7878
for (var i=0,l=items.length; i<l; i++) {
7979
var li = document.createElement('li');
8080
if (items[i].type === 'action') {
81-
var a = document.createElement('a');
81+
var a = document.createElement('a'),
82+
className = items[i].className ? items[i].className : '';
83+
items[i].disabled && (className += 'disabled');
8284
a.href='#';
83-
a.className = items[i].className;
8485
a.innerHTML = items[i].label;
86+
li.className = className;
8587
li.onclick = (function (i) {
8688
return function (e) {
8789
items[i].click.call(this, e);

src/framework.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ define(['src/command-component/cmd-cmt'], function (cc) {
4747
type: 'action',
4848
label: 'action1',
4949
className: '',
50+
disabled: true,
5051
click: function (e) {
5152
console.log(1);
5253
}
@@ -69,16 +70,17 @@ define(['src/command-component/cmd-cmt'], function (cc) {
6970
type: 'divider'
7071
},{
7172
type: 'header',
72-
label: 'header1'
73+
label: 'header2'
7374
},{
7475
type: 'action',
75-
label: 'action2',
76+
label: 'action4',
77+
disabled: true,
7678
click: function (e) {
7779
console.log(4);
7880
}
7981
},{
8082
type: 'action',
81-
label: 'action3',
83+
label: 'action5',
8284
click: function (e) {
8385
console.log(5);
8486
}

0 commit comments

Comments
 (0)