11.1&2首页的基础架构搭建

Chapter:11.前端页面开发

11.1. 首页的基础架构搭建

就是把

里的元信息写上和引入相关的js库,下载好相关的js文件


    
        
        
        
        
        书城首页
    
    
        

11.2.首页HTML代码的模块化拆分

页面的很多部分是不变的,代码是可以复用的,所以可以在view文件夹下建include文件夹,储存能复用的模块代码。

1.创建各模块文件

下面是首页的各模块,虽然有模块不会复用,但是也可以单独抽出来写成独立文件,方便修改

header.html(顶部栏)
index-bottom.html(底部栏)
index-female.html(女频)
index-male.html(男频)
index-free.html(免费区)
index-hot.html(首页热门)
index-recommend.html(首页推荐)
index-top.html(首页滚动活动页)

2.在index.html里引入

在首页index.html引入各模块代码,注意不要写错路径和名字,不然会直接报"internal serve error"错误

<%include include/header.html %>
<% include include/index-top.html %>
<% include include/index-hot.html %> <% include include/index-recommend.html %> <% include include/index-female.html %> <% include include/index-male.html %> <% include include/index-free.html %> <% include include/index-bottom.html %>

你可能感兴趣的:(11.1&2首页的基础架构搭建)