huangbo 9 anni fa
parent
commit
ea671b01cc

+ 1 - 1
display-server/web/biz/js/tag/WmDropmenu.js

@ -90,7 +90,7 @@ require(["domReady!","wmWebUI","jcl","iScroll","mobile"],function(doc,WmWebUI,$,
90 90
	/*更新菜单项*/
91 91
	$("#testHtml").tap(function(){
92 92
		var dropmenu=WmWebUI.select("myDropmenu");
93
		var item = dropmenu.getDropmenuItem(dropmenu.getDropmenuItems().length-1);
93
		var item = dropmenu.getDropmenuItem(dropmenu.getDropmenuItems().length-1);//获取最后一个菜单项
94 94
		item.html("新的下拉菜单项");
95 95
		alert("更新成功");
96 96
	});

+ 11 - 11
display-server/web/res/js/ui/wm-dropmenu.js

@ -26,7 +26,7 @@ define(["jcl","wmWebUI"],function($,WmWebUI){
26 26
			WmWebUI.store(dropmenuItem.id, this);
27 27
		}
28 28
	}
29
	/*移除下拉项*/
29
	/*移除下拉菜单项*/
30 30
	WmDropmenuItem.prototype.remove = function() {
31 31
		this.dropmenuItem.parentNode.removeChild(this.dropmenuItem);
32 32
		this.dropmenu.items.splice(this.index, 1);//删除第index个元素
@ -35,7 +35,7 @@ define(["jcl","wmWebUI"],function($,WmWebUI){
35 35
		}
36 36
		this.dropmenu.initMenu();
37 37
	}
38
	/*设置下拉选项的文本内容*/
38
	/*设置或返回下拉菜单项的html*/
39 39
	WmDropmenuItem.prototype.html = function(html) {
40 40
		if (html == undefined) {
41 41
			return this.dropmenuItem.innerHTML;
@ -43,7 +43,7 @@ define(["jcl","wmWebUI"],function($,WmWebUI){
43 43
			this.dropmenuItem.innerHTML = html;
44 44
		}
45 45
	}
46
	/*设置下拉项的事件*/
46
	/*设置下拉菜单项的事件*/
47 47
	WmDropmenuItem.prototype.setAction = function(action) {
48 48
		var that = this;
49 49
		this.action = action;
@ -51,7 +51,7 @@ define(["jcl","wmWebUI"],function($,WmWebUI){
51 51
			that.action && that.action(that);
52 52
		});
53 53
	}
54
	/*获取下拉项的序号*/
54
	/*获取下拉菜单项的序号*/
55 55
	WmDropmenuItem.prototype.getIndex=function(){
56 56
		return this.index;
57 57
	}
@ -89,7 +89,7 @@ define(["jcl","wmWebUI"],function($,WmWebUI){
89 89
			}
90 90
		});
91 91
	};
92
	/*获取标签菜单项*/
92
	/*获取下拉菜单项*/
93 93
	WmDropmenu.prototype.getDropmenuItem = function(index){
94 94
		return this.items[index];
95 95
	}
@ -119,12 +119,12 @@ define(["jcl","wmWebUI"],function($,WmWebUI){
119 119
		this.selectLabel.find(".e_ico-unfold").css("-webkit-transform","rotate(0)");
120 120
		this.menu.css("display","none");
121 121
	};
122
	/*删除所有下拉菜单项*/
122
	/*删除所有下拉菜单项*/
123 123
	WmDropmenu.prototype.removeAll = function() {
124 124
		this.menu.children("ul")[0].innerHTML = "";
125 125
		this.items = new Array();
126 126
	};
127
	/*添加下拉菜单项*/
127
	/*添加下拉菜单项*/
128 128
	WmDropmenu.prototype.push = function(obj){
129 129
		this.menu.children("ul").append("<li>"+obj+"</li>");
130 130
		this.initMenu();
@ -133,19 +133,19 @@ define(["jcl","wmWebUI"],function($,WmWebUI){
133 133
		this.items.push(item);
134 134
		return item;
135 135
	};
136
	/* 设置下拉菜单文本 */
136
	/*设置下拉菜单文本 */
137 137
	WmDropmenu.prototype.setLabel = function(label) {
138 138
		this.selectLabel.children("span")[0].innerHTML = label;
139 139
	};
140
	/* 获取下拉菜单文本 */
140
	/*获取下拉菜单文本 */
141 141
	WmDropmenu.prototype.getLabel = function() {
142 142
		return this.selectLabel.children("span")[0].innerHTML;
143 143
	};
144
	/* 设置打开下拉菜单事件 */
144
	/*设置下拉菜单打开事件 */
145 145
	WmDropmenu.prototype.setOpenAction = function(callback) {
146 146
		this.openAction = callback;
147 147
	};
148
	/* 设置关闭下拉菜单事件 */
148
	/*设置下拉菜单关闭事件 */
149 149
	WmDropmenu.prototype.setCloseAction = function(callback) {
150 150
		this.closeAction = callback;
151 151
	};