zoukankan      html  css  js  c++  java
  • node.js+express+jade系列四:jade嵌套的使用

    jade是express自带的模板引擎

    jade文件可以嵌套使用,include引用外部jade文件,extends引用jade模板

    例如

    有一个主jade文件layout.jade,引用top.jade和footer.jade这两个

    如下设计

    1:layout.jade的文件

    doctype html
    html
      head
        title blog
        link(rel='stylesheet', href='/stylesheets/style.css')
      body
        div#m_div
          include top
          block content_main
          include footer

    2:top.jade

    div#top
        div#menu
            ul
                li
                    a(href="/") 首页
                li
                    a(href="/") 博文
                li
                    a(href="/") 随笔
                li
                    a(href="/") 管理

    3:footer.jade

    div#footer
        div#footer_info footer

    主要是红色部分

        include:用来引用外部jade文件

        block:标识当引用layout是显示的部分

    4:index.jade文件,引用layout.jade文件

         通过extends layout 引用,类似于asp.net中的master页面

    extends layout

    block content_main

        div#m_left
            div#m_left_login
                div#login_success
                fieldset#login_fm
                    legend 登录
                    label 用户名:
                    input(type="text",id="username",name="username" style="150px;border:1px #ccccff solid;")
                    br
                    br
                    label 口   令:
                    input(type="password", id="pwd",name="pwd" style="150px;border:1px #ccccff solid;")
                    br
                    br
                    button(id="loginBtn",name="loginBtn", onclick="loginClick()") 登录

    模板引用完成

  • 相关阅读:
    约束constraint
    多表查询
    多表关系
    vue 页面跳转的两种方式
    Java三大特性
    如何搭建vue搭建手脚架(vue-cli 3.0以上版本)
    Mysql高版本不兼容group by解决方案
    springboot整合shiro 报 This application has no explicit mapping for /error, so you are seeing this as a fallback. 错误
    使用Springboot整合redis与mysql
    Springboot登录拦截器
  • 原文地址:https://www.cnblogs.com/ajun/p/3546455.html
Copyright © 2011-2022 走看看