Files
ClassContent/历届学生/front-end-team/项目练习/学生项目/缪虎/屁桃儿/笔记.txt
2024-09-27 02:06:13 +08:00

45 lines
1.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

写页面
调接口
ajax 如何封装
页面 ---> 中间层
中间层 ---> ajax 封装
渲染接口数据到页面
绑定事件,实现功能 (封装方法,数组+下标)
思路:
1:index.js 中的 Index 类被初始化的时候,类的 构造函数 constructor 将被自动运行,
构造函数中的变量 index 和 principal 将被定义,方法 getClassApi 将被自动执行
2:getClassApi 被执行,发送请求获取 横向 菜单的数据,保存到 全局变量 principal 数组中。
遍历 principal 首先生成 li 横向菜单,然后生成li所对应的 列表内容
页面生成好后,开始初始化页面轮播图,为菜单的li标签批量绑定点击事件
3:请求首页的接口数据,然后通过数组加下标的规则找到 对应的 swiper-slide,将数据插入
【陆旗】1: 搜索
注意:从首页点击的时候,跳转进入 search.html 页面。
接口:http://127.0.0.1:3000/api/json/search?keyword=jk
参数:keyword
【李康】2:机构
注意:li 标签内部套 a标签
接口:http://127.0.0.1:3000/api/json/mechanism
参数:无
【缪虎】3:模特
注意:无
接口:http://127.0.0.1:3000/api/json/mechanism
参数:无