Commit 65a7d306 authored by campaign's avatar campaign

by zhanyi

parent 051e2621
//dropmenu 类 //dropmenu 类
KM.ui.define('dropmenu', { KM.ui.define('dropmenu', {
tmpl: '<ul class="kmui-dropdown-menu" aria-labelledby="dropdownMenu" >' + tmpl: '<ul class="kmui-dropdown-menu" aria-labelledby="dropdownMenu" >' +
'<%for(var i=0,ci;ci=data[i++];){%>' + this.subTmpl +
'</ul>',
subTmpl: '<%if(data && data.length){for(var i=0,ci;ci=data[i++];){%>' +
'<%if(ci.divider){%><li class="kmui-divider"></li><%}else{%>' + '<%if(ci.divider){%><li class="kmui-divider"></li><%}else{%>' +
'<li <%if(ci.active||ci.disabled){%>class="<%= ci.active|| \'\' %> <%=ci.disabled||\'\' %>" <%}%> data-value="<%= ci.value%>">' + '<li <%if(ci.active||ci.disabled){%>class="<%= ci.active|| \'\' %> <%=ci.disabled||\'\' %>" <%}%> data-value="<%= ci.value%>">' +
'<a href="#" tabindex="-1"><em class="kmui-dropmenu-checkbox"><i class="kmui-icon-ok"></i></em><%= ci.label%></a>' + '<a href="#" tabindex="-1"><em class="kmui-dropmenu-checkbox"><i class="kmui-icon-ok"></i></em><%= ci.label%></a>' +
'</li><%}%>' + '</li><%}}%>' +
'<%}%>' + '<%}%>',
'</ul>',
defaultOpt: { defaultOpt: {
data: [], data: [],
click: function () { click: function () {
} }
}, },
setData:function(items){
this.root().html($.parseTmpl(this.subTmpl,items));
return this;
},
position:function(offset){
this.root().offset(offset);
return this;
},
show:function(){
if(this.trigger('beforeshow') === false){
return;
}else{
this.root().css({display:'block'});
this.trigger('aftershow');
}
return this;
},
init: function (options) { init: function (options) {
var me = this; var me = this;
var eventName = { var eventName = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment