huangbo 9 years ago
parent
commit
ea671b01cc

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

90
	/*更新菜单项*/
90
	/*更新菜单项*/
91
	$("#testHtml").tap(function(){
91
	$("#testHtml").tap(function(){
92
		var dropmenu=WmWebUI.select("myDropmenu");
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
		item.html("新的下拉菜单项");
94
		item.html("新的下拉菜单项");
95
		alert("更新成功");
95
		alert("更新成功");
96
	});
96
	});

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

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