实现 this 指向

This commit is contained in:
编码猿
2025-12-08 13:54:20 +08:00
parent dc70b5fc26
commit d1e37320d3
7 changed files with 280 additions and 70 deletions

View File

@@ -56,25 +56,25 @@ module.exports = {
errors: true
},
// before 这块代码都可以删除,仅仅为脚手架提供一个用于测试的接口
before: function (app, server) {
app.all('*', function (req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', '*');
res.header('Access-Control-Allow-Methods', '*');
res.header('Content-Type', 'application/json;charset=utf-8');
next();
});
app.get('/UserList', function (req, res) {
res.json({
status: 200,
message: '请求成功',
result: [
{ id: 1, name: '张三' },
{ id: 2, name: '李四' }
]
});
});
},
// before: function (app, server) {
// app.all('*', function (req, res, next) {
// res.header('Access-Control-Allow-Origin', '*');
// res.header('Access-Control-Allow-Headers', '*');
// res.header('Access-Control-Allow-Methods', '*');
// res.header('Content-Type', 'application/json;charset=utf-8');
// next();
// });
// app.get('/UserList', function (req, res) {
// res.json({
// status: 200,
// message: '请求成功',
// result: [
// { id: 1, name: '张三' },
// { id: 2, name: '李四' }
// ]
// });
// });
// },
// proxy: {
// '/api': {
// target: 'http://115.159.153.142:9010/h5',
@@ -111,7 +111,7 @@ module.exports = {
plugins: [
new ProgressPlugin({
handler: (percentage, message, ...args) => {
console.log(`${chalk.yellow("进度: ")}${chalk.green.bold(~~(percentage * 100) + "%")} ${args[0] ? chalk.black(args[0]) : " " } ${chalk.blue.bold(message)}`)
console.log(`${chalk.yellow("进度: ")}${chalk.green.bold(~~(percentage * 100) + "%")} ${args[0] ? chalk.black(args[0]) : " "} ${chalk.blue.bold(message)}`)
},
})
]