°à´ÎÁбí ÕýÔÚ¼ÓÔØ... list.html
list.htmlwebapp ©À©¤blade //¿ò¼ÜĿ¼ ©¦ ©À©¤data ©¦ ©À©¤libs ©¦ ©À©¤mvc ©¦ ©¸©¤ui ©À©¤bus ©¦ ©À©¤model //Êý¾ÝÇëÇóÄ£¿é£¬ÍêÈ«¿ÉÒÔʹÓÃzepto ajaxÌæ»» ©¦ ©¸©¤pages ©¦ ©À©¤booking ©¦ ©À©¤index ©¦ ©¸©¤list //demo´úÂëÄ£¿é ©¸©¤static
½ÓÏÂÀ´£¬ÈÃÎÒÃÇÕæÊµµÄ¿ªÊ¼²ð·ÖÒ³Ãæ°É¡£
×é¼þʽ±à³Ì ¹Ç¼ÜÉè¼ÆÊ×ÏÈ£¬ÎÒÃǽøÐÐ×î¼òµ¥µÄ¹Ç¼ÜÉè¼Æ£¬ÕâÀïÒÀ´ÎÊÇÆäjs´úÂëÓëÄ£°å´úÂ룺
1 define(['AbstractView', 'text!ListPath/list.css', 'text!ListPath/tpl.layout.html'], function (AbstractView, style, layoutHtml) { 2 return _.inherit(AbstractView, { 3 propertys: function ($super) { 4 $super(); 5 this.style = style; 6 this.template = layoutHtml; 7 }, 8 9 initHeader: function (name) { 10 var title = '°à´ÎÁбí'; 11 this.header.set({ 12 view: this, 13 title: title 14 }); 15 }, 16 17 addEvent: function () { 18 this.on('onShow', function () { 19 console.log('Ò³ÃæäÖȾ½áÊø'); 20 }); 21 } 22 }); 23 });
ÈÕÀú¹¤¾ßÌõÄ£¿é µ±Ç°ÔÝÎÞ°à´Î¿ÉÔ¤¶© ÁбíÄ£¿é ÕýÔÚ¼ÓÔØ...³ö·¢Ê±¶ÎÈ«Ìì³ö·¢Æû³µÕ¾È«²¿³µÕ¾µ½´ïÆû³µÕ¾È«²¿³µÕ¾
tpl.layoutÒ³ÃæÕ¹Ê¾Èçͼ£º
ÕâÀïÒª×öµÄµÚÒ»²½Êǽ«ÈÕÀú¹¤¾ßÀ¸Ä£¿éʵÏÖ£¬ÒÔÊý¾ÝΪÏȵÄ˼¿¼£¬ÎÒÃÇÏÈʵÏÖÁËÒ»¸öÓëÈÕÀúÒµÎñÓйصÄÊý¾ÝʵÌ壺
1 define(['AbstractEntity'], function (AbstractEntity) { Entity = _.inherit(AbstractEntity, { 4 propertys: function ($super) { 5 $super(); 6 var n = new Date(); 7 var curTime = new Date(n.getFullYear(), n.getMonth(), n.getDate()).getTime(); 8 this.data = { 9 date: curTime, 10 title: 'µ±Ç°ÈÕÆÚ' 11 }; 12 }, 13 14 set: function (date) { 15 if (!date) return; 16 if (_.isDate(date)) date = date.getTime(); 17 if (typeof date === 'string') date = parseInt(date); 18 this.data.date = date; 19 this.update(); 20 }, 21 22 getDateStr: function () { 23 var date = new Date(); 24 date.setTime(this.data.date); 25 var dateDetail = _.dateUtil.getDetail(date); 26 var name = dateDetail.year + '-' + dateDetail.month + '-' + dateDetail.day + ' ' + dateDetail.weekday + (dateDetail.day1 ? '(' + dateDetail.day1 + ')' : ''); 27 return name; 28 }, 29 30 nextDay: function () { 31 this.set(this.getDate() + 86400000); ; 33 }, 34 35 getDate: function () { 36 return parseInt(this.data.date); 37 }, canPreDay: function () { 41 var n = new Date(); 42 var curTime = new Date(n.getFullYear(), n.getMonth(), n.getDate()).getTime(); (curTime <= this.getDate() - 86400000) { ; 47 } ; 49 }, 50 51 preDay: function () { ; 53 this.set(this.getDate() - 86400000); ; 55 } 56 57 }); Entity; 60 });
en.dateÀïÃæÍê³ÉÈÕÆÚ¹¤¾ßÀ¸ËùÓÐÏà¹ØÊý¾Ý²Ù×÷£¬²¢ÇÒ²»°üº¬Êµ¼ÊµÄÒµÎñÂß¼¡£
È»ºóÕâÀ↑ʼÉè¼ÆÈÕÆÚ¹¤¾ßÀ¸µÄÄ£¿éView£º
¡¡