给链接类型的模块添加链接

第一步:继承 Link

   public class MobileBottom :Link, IWidget {
        public object SetDefault() {
            return null;
        }
    }

第二步:设置默认值

  /// <summary>
        /// 设置默认值
        /// </summary>
        /// <returns></returns>
        public object   SetDefault() {
            List<Link> list = new List<Link>();
            Link link = new Link("首页", "/User/Index", "fa fa-home",1);
            list.Add(link);
            link = new Link("二维码名称", "/User/QrCode", "fa fa-home",10);
            list.Add(link);
            link = new Link("家谱图", "/User/Tree", "fa fa-tree",20);
            list.Add(link);
            link = new Link("密码修改", "/User/Security", "fa fa-lock",1100);
            list.Add(link);
            link = new Link("账户信息", "/User/Index", "fa fa-phone ",1101);
            list.Add(link);
            return list.ToJson();
        }

第三步:绑定数据

            @{
                var list = ContainerManager.Default.Resolve<IThemeConfigService>().GetLinkList(info);
               
            }
            @foreach (var item in list) {
                <li>
                    <a href="@item.Url" target="" title="@item.Title">
                        <i class="@item.Icon"></i>@item.Name
                </a>
            </li>
            }

 

posted on 2016-07-01 09:50  ZKCloud  阅读(262)  评论(0编辑  收藏  举报