AmazeUI(ÃÃ×ÓUI)ÊǷdz£ÓÅÐãµÄ¹ú²úÇ°¶ËUI£¬ÏÖÔÚÀ´½éÉÜÒ»ÏÂAmazeUIÖÐCSS×é¼þ¡¢JS²å¼þÓëWeb×é¼þµÄÇø±ð¡£
CSS×é¼þ¹ËÃû˼Òå¾ÍÊǽöʹÓÃCSSäÖȾ¶ø³ÉµÄ×é¼þ£¬¶øJS²å¼þÒ²ºÜÈÝÒ×Àí½â£¬¾ÍÊÇÓÉCSSäÖȾºÍJSÀ´¿ØÖÆÐÐΪµÄ×é¼þ¡£
±È½Ï²»ºÃÀí½â¾ÍÊÇWeb×é¼þ£¬ºÃÏñ¸úJS²å¼þÒâ˼²î²»¶à£¬¶¼ÊÇCSSºÍJS×é³ÉµÄ¡£ËüÃǵ½µ×Çø±ðÔÚÄÄ£¿ÎÒÃÇÖصãÀ´½²Õâ¸ö¡£
ÎÒÃÇͨ¹ýѧϰÈçºÎµ÷ÓÃWeb×é¼þ£¨ÆäÖеÄÊÖ·çÇÙ×é¼þ£©À´Ò»²½Ò»²½Á˽âÆäÓëJS²å¼þµÄÇø±ð¡£
ʾÀý01.Web×é¼þ-Ö±½ÓʹÓà (ÇëÏÂÔظ½¼þ²é¿´Ê¾Àý)
ʾÀýÖйؼü´úÂ룺
ʾÀý02.Web×é¼þ-ͨ¹ýÄ£°åÀ´µ÷ÓÃ-ʾÀý1 (ÇëÏÂÔظ½¼þ²é¿´Ê¾Àý)
ʾÀýÖйؼü´úÂë1£¨ÒýÓà handlebars.js ºÍ ÃÃ×Óuiµ÷ÓÃhandlebars.jsµÄ¸¨Öújs£©£º
ʾÀýÖйؼü´úÂë2£¨¶¨ÒåÒ»¸öÄ£°å£©£¨»°ËµÕâ¸öÄ£°åҲûɶʵ¼ÊÒâÒ壬µ«¹Ù·½µÄdemo¾ÍÊÇÕâôдµÄ£¬ÎÒÖ»ÊÇÒÆÖ²ÁËһϣ©£º
accordion accordionData}}
ʾÀýÖйؼü´úÂë3£¨µ÷ÓÃJS´úÂëʹÆ乤×÷£©£º
template = Handlebars.compile($tpl.text()), html = template(data); $tpl.before(html); //ÏÔʾ½á¹û
ʾÀý03.Web×é¼þ-ͨ¹ýÄ£°åÀ´µ÷ÓÃ-ʾÀý2 (ÇëÏÂÔظ½¼þ²é¿´Ê¾Àý)
ʾÀýÖйؼü´úÂë1£¨ÒýÓà handlebars.js ºÍ ÃÃ×Óuiµ÷ÓÃhandlebars.jsµÄ¸¨Öújs£©£º ͬÉÏ£¬ËùÒÔÊ¡ÂÔ...
ʾÀýÖйؼü´úÂë2£¨µ÷ÓÃJS´úÂëʹÆ乤×÷£©£º
html = template(data.accordionData); $("#div1").before(html); //ÏÔʾ½á¹û
ʾÀý04.Web×é¼þ-ͨ¹ý×Ô¶¨ÒåÄ£°åÀ´µ÷Óà (ÇëÏÂÔظ½¼þ²é¿´Ê¾Àý)
ʾÀýÖйؼü´úÂë1£¨ÒýÓà handlebars.js £©
¡¡¡¡
¡¡¡¡²»Ò»ÑùµÄµØ·½ÔÚÓÚ£¬Õâ´ÎÖ»ÒýÓÃÁË handlebars.js £¬¶øûÓÐÒýÓà ÃÃ×Óuiµ÷ÓÃhandlebars.jsµÄ¸¨Öújs £¬ÒòΪ²»ÐèÒªÁË¡£
ʾÀýÖйؼü´úÂë2£¨×Ô¶¨ÒåÔʼģ°å£©£º
}}
ʾÀýÖйؼü´úÂë3£¨µ÷ÓÃJSʹÆ乤×÷£©£º
"content": [..Ê¡ÂÔ.., { 3 "title": "±êÌâ¶þ", 4 "content": "ÄÚÈݶþ", }, ..Ê¡ÂÔ..] 7 }; demoHtml = demoTemplate(demoData); $("#div1").html(demoHtml); //ÏÔʾ½á¹û
ʾÀý05.Web×é¼þ-»ªÈðÊÖ·çÇÙ×é¼þ (ÇëÏÂÔظ½¼þ²é¿´Ê¾Àý)
ʾÀýÖйؼü´úÂë1£¨huarui.accordion.helper.js£©£º
ÕâÊÇÒ»¸ö×Ô¶¨ÒåWeb×é¼þµÄjsÖ§³ÖÎļþ£¬Õâ¸öÎļþµÄ±àдºÜ¼òµ¥£¬¸´ÖÆ amazeui.widgets.helper.js ¸ÄÒ»¸Ä¾ÍºÃÁË¡£
hbs.registerPartial('hr-accordion', '\ 3 {{#this}}\ 4 <section data-am-widget="accordion" {{#if id}} {{/if}} data-am-accordion=\'{ {{#if options.multiple}}"multiple": true{{/if}} }\'>\ 5 {{#each content}}\ 6 <dl>\ 7 <dt>\ 8 <!-- Ìí¼Óͼ±êµÄ¹Ø¼ü´úÂë -->\ 9 {{#if icon}}<img src="{{icon}}" />{{/if}}\ 10 {{{title}}}\ 11 </dt>\ 12 <dd>\ 13 <div>\ 14 {{{content}}}\ 15 </div>\ 16 </dd>\ 17 </dl>\ 18 {{/each}}\ 19 </section>\ 20 {{/this}}');
ʾÀýÖйؼü´úÂë2£¨ÒýÓÃÏà¹ØjsÎļþ£©£º
ʾÀýÖйؼü´úÂë3£¨µ÷ÓÃJSʹÆ乤×÷£©£º
"content": [..ÂÔ.., { 3 "title": "±êÌâ¶þ", 4 "content": "ÄÚÈݶþ", }, ..ÂÔ..] 7 }; demoHtml = Handlebars.compile('{{>hr-accordion}}')(demoData); 10 $("#div1").html(demoHtml); //ÏÔʾ½á¹û
¿´ÍêÒÔÉϵÄʾÀý£¬µÃ³ö½áÂÛ£º
ÔÚAmazeUI£¨ÃÃ×ÓUI£©ÖУ¬Web×é¼þ¿ÉÒÔ²»±àдģ°å¶øÖ±½ÓʹÓã¬ÈôÈç´Ë£¬ÔòÓëJS²å¼þûʲô̫´óÇø±ð£¬¹Ù·½Ô»°Ò²Ëµ¿ÉÒÔÕâôµ÷Óõġ£
Web×é¼þÓëJS²å¼þµÄ²»Í¬Ö®´¦ÔÚÓÚ£¬Web×é¼þ½èÖú handlebars.js ʵÏÖÁËÇ¿´óµÄÄ£°å¹¦ÄÜ£¬ÎÒÃÇÄܱàд×Ô¶¨ÒåÄ£°å´Ó¶øʹWeb×é¼þ¸ü¾ß¸öÐÔ£¬ÉõÖÁÊDZàд³öеÄWeb×é¼þ¡£
ÏÂÔظ½¼þ£ºAmazeUIµÄWeb×é¼þ.zip
¡¡