Skip to content

Instantly share code, notes, and snippets.

@mizhdi
Last active August 29, 2015 14:12
Show Gist options
  • Save mizhdi/6867f2346651423da221 to your computer and use it in GitHub Desktop.
Save mizhdi/6867f2346651423da221 to your computer and use it in GitHub Desktop.
常用j s
// 1
var htmlSurpriseTab = [
'<div>',
'<button id="lucky-draw">Lucky Draw</button>',
'</div>'
].join('');
// 2
actionList[actionName] && actionList[actionName].call(this,event);
// 3
CMUI.dialog = {
template: [
'<div class="dialog">',
'<a href="#" data-action="close-dialog">×</a>',
'<h2><%= data.title %></h2>',
'<div class="content"><%- data.html %></div>',
'</div>'
].join(''),
init: function () {
action.add({
'close-dialog': function () {
$(this).closest('.dialog').hide()
}
})
},
open: function (config) {
var html = render(this.template, config)
$(html).appendTo('body').show()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment