01 Preface
Last semester is the first semester of junior year
At the end of the big homework, I imitated Sina News to simulate this fake homework with mockjs
The bottom navigation bar has the following:
A rough introduction to each page:
02 Home-News-Rendering
Click here to see the details page. Pull
to the bottom to click the share function
03 Comment page-renderings
Click here to see the details page.
Similarly, pull to the bottom to click to share
04 Ranking page-renderings
Click to enter the details page
05 The key realization process
Create a new folder: api
writes the encapsulation method in it, and introduces it in the page that needs to be used.
Some source codes are as follows:
const events = require('../mocks/events.js')
//获取评论列表
//这里的函数里面取的就是mocks的数据
const getEventsList = () => {
// const detail=news.find(e=>e.id===id);
return events;
}
//获取评论详情
const getEventsDetail = (id) => {
const detail = events.find(e => e.id == id);
return detail;
}
module.exports = {
getEventsList,
getEventsDetail
}
Create a new folder: mocks
write fake data in it, call it in wsml to
dynamically obtain data
, import data in the page circularly, and display data in the detail page respectively
My tools
06 Directory structure