发布时间:2023-07-17 14:30
npm http-proxy-middleware
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function(app) {
app.use(
'/ajax', // /api/list /api/detail /api/center /api/cart
createProxyMiddleware({
target: 'https://i.maoyan.com',
changeOrigin: true
})
);
};
以https://i.maoyan.com/ajax/comingList?xxx路径为例
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function(app) {
app.use(
'/ajax', 以ajax路径为开始的
createProxyMiddleware({
target: 'https://i.maoyan.com',
changeOrigin: true
})
);
app.use可以有多个 路径不同即可
app.use(
'/ajax2',
createProxyMiddleware({
target: 'https://i.maoyan.com',
changeOrigin: true
})
);
};
axios.get("/ajax/comingList?xx").then(res=>{
在引用css文件时不是
import ‘./xx/xx.css’
而是
import style from './xx/xx.css
创建className
正在热映
当给标签选择器设置css时应给它添加一个父级标签 不然会导致与其他组件样式重叠
设置css样式
.film ul li
-