Commit 7555b249 authored by 刘丹's avatar 刘丹 Committed by hujun

菜单

parent b2845d47
......@@ -30,13 +30,17 @@ define(['doT', 'jquery', 'text!temp/menu_template_tpl.html'], function (doT, $,t
function menu_bar() {
var user_info_obj = localStorage.getItem('user_info'); //读取缓存
$ ("#menu_bar").append (template);
if (typeof user_info_obj === 'string') {
var user_info = JSON.parse(user_info_obj);
console.log(user_info);
var temp = document.getElementById ('menu_tpl').innerHTML;
var doTtmpl = doT.template (temp);
$ ("#dropdownMenu1").append(user_info['name']);
$ ("#menu_bar").html (doTtmpl (user_info['menu']));
} else {
$.ajax ({
url: '/index/getMenu',
......
......@@ -3,7 +3,7 @@
[% for(var item in it){ %]
<li class="dropdown">
[% if(it[item]["_child"] == undefined || it[item]["_child"].length == 0) { %]
<a href="[%= it[item]['name'] %]" >[%= it[item]["title"] %]</a>
<a href="[%= it[item]['name'] %]" ><span class="glyphicon glyphicon-credit-card" aria-hidden="true"></span> <span class="span-list">[%= it[item]["title"] %]</span></a>
[% } else { %]
<a href="" class="dropdown-toggle" data-toggle="dropdown"> <span class="glyphicon glyphicon-credit-card" aria-hidden="true"></span><span class="span-list">[%= it[item]["title"] %]</span>
<span class="glyphicon glyphicon-hand-down" aria-hidden="true"></span></a>
......
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