基于 Vue3.x + NodeJS实现的课程表排课系统(二)
初始化样式
src/assets/resets.css
body,
p,
h1 {
margin: 0;
}
h1 {
font-weight: normal;
}
a {
text-decoration: none;
color: #666;
}
button {
outline: none;
border: none;
}
ul {
padding: 0;
margin: 0;
list-style: none;
}
main.js
全局引入
import "./assets/resets.css";
封装axios处理数据
在client/src
下新建文件夹lib/http.js
import axios from "axios";
import qs from "qs";
export function httpGet(url) {
return new Promise((resolve, reject) => {
axios(url)
.then((res) => {
const {
code, msg, data } = res.data;
if (code === 0) {
resolve(data);
} else {
reject(mssg);
}
})
.catch((err) => {
reject(err);
});
});
}
export function httpPost(url, body) {
return new Promise(