'use strict';require('./index.css');var _mm ? ? ? ? ? ? = require('util/mm.js');var templateIndex ? = require('./index.string');// 側(cè)邊導(dǎo)航var navSide = {? ? option : {? ? ? ? name : ' ',? ? ? ? navList : [? ? ? ? ? ? {name : 'user-center', ? desc : '個人中心', ?href: './user-center.html'},? ? ? ? ? ? {name : 'order-list', ? desc : '我的訂單', ?href: './order-list.html'},? ? ? ? ? ? {name : 'pass-update', desc : '修改密碼', ?href: './pass-update.html'},? ? ? ? ? ? {name : 'about', desc : '關(guān)于MMall', href: './about.html'}? ? ? ? ] },? ? init : function(option){? ? ? ? // 合并選項 $.extend(this.option, option);? ? ? ? this.renderNav();? ? },? ? // 渲染導(dǎo)航菜單? ? renderNav : function(){? ? ? ? // 計算active數(shù)據(jù)? ? ? ? for(var i = 0, iLength = this.option.navList.length; i < iLength; i++){? ? ? ? ? ? if(this.option.navList[i].name === this.option.name){? ? ? ? ? ? ? ? this.option.navList[i].isActive = true;? ? ? ? ? ? } };? ? ? ? // 渲染list數(shù)據(jù)? ? ? ? var navHtml = _mm.renderHtml(templateIndex, {? ? ? ? ? ? navList : this.option.navList? ? ? ? });? ? ? ? // 把html放入容器? ? ? ? $('.nav-side').html(navHtml);? ? }};module.exports = navSide;