-
-
Notifications
You must be signed in to change notification settings - Fork 620
Open
Description
DESC
think找不到命名空间
ENV
OS Platform:win10
Node.js Version:14.0.0
ThinkJS Version:3.2.11
code
import { Context, think } from 'thinkjs';
export default class extends think.Controller {
constructor(ctx: Context) {
super(ctx); // 调用父级的 constructor 方法,并把 ctx 传递进去
}
__before() {
// 头部数据处理
const method = this.method.toLowerCase();
this.header('Access-Control-Allow-Origin', this.header('origin') || '*');
this.header(
'Access-Control-Allow-Headers',
'Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, Authorization'
);
this.header('Access-Control-Allow-Methods', 'GET,POST,OPTIONS,PUT,DELETE');
this.header('Access-Control-Allow-Credentials', true);
if (method === 'options') {
return this.success();
}
}
}
error message

more description
// your detail description
Metadata
Metadata
Assignees
Labels
No labels