1.添加模板
<script id="userinfo" type="text/template">
          {{ if id == null }}
          <li class="login" style="white-space:nowrap;height:32px;line-height:32px;"><a href="login_f.html" >登录</a> 
              <a  href="register.html" target="_blank">注册</a>
              <a href="userOrder.html">我的订单 </a> </li>
          {{ else if id != null }}
          <li class="login" style="white-space:nowrap;height:32px;line-height:32px;">
              <b>您好,欢迎您来到蕴锦IT服务平台</b> <a href="userAccount/userInfo.html" target="_blank">{{nickName}}</a> 
              <a target="_blank" onclick="logOut()">退出登录</a>
              <a href="userOrder.html">我的订单 </a> </li>
              {{ /if }}
        </script>
 
2.jquery获取页面模板并引入template到jQuery并返回到页面
$(function(){
    var $userinfo=$('#userInfo1');
    const users=localStorage.getItem("usercurre");
    var user=JSON.parse(users);
    console.log(user)
    var html =template('userinfo',user);
    $userinfo.html(html);
})

最新文章

  1. 网站美化常见CSS
  2. BackTrack5-r3任务栏显示网络图标及自定义DNS
  3. Spark Streaming源码解读之No Receivers彻底思考
  4. 未能加载文件或程序集&ldquo;System.Web.Http.WebHost, Version=4.0.0.0, &rdquo;或它的某一个依赖项。系统找不到指定的文件。
  5. android oncreate获取宽高度
  6. UVALive 5888 Stack Machine Executor (栈+模拟)
  7. SQL_转换格式的函数—CAST()和CONVERT()
  8. tomcat 系统架构与设计模式 第二部分 设计模式 转
  9. javabean 简介
  10. [转] JSON for java入门总结
  11. 简单竖向Tab选项卡
  12. Eclipse用法和技巧三:自动生成Main方法2
  13. Cordic 算法之 反正切
  14. EF Code First、DbContext
  15. Ajax原理、优缺点及应用场景
  16. 【linux之设备,分区,文件系统】
  17. 问题7:JavaScript 常用正则示例
  18. [转][html]设置IIS 默认页
  19. ubuntu下安装php
  20. spring data redis的配置类RedisConfig

热门文章

  1. 启动Spring Tool Suite 4时出现 could not find tools.jar spring boot live hovers....弹窗
  2. vue 前端处理监听关键字搜索
  3. Idea集成SpringBoot实现两种热部署方式(亲测有效)
  4. C#winfrom文件下载到本地
  5. 【SSM Spring 线程池 OJ】 使用Spring线程池ThreadPoolTaskExecutor
  6. Elasticsearch系列---简单入门实战
  7. jQuery学习笔记3
  8. Java基础IO类之字节输入输出流
  9. python网络爬虫之自动化测试工具selenium[二]
  10. Ansible Playbooks 介绍 和 使用 一