跳转到内容

Value assigned to locals is not accepted.

LocalsNotAnObject: locals 只能被赋值为一个对象。不接受如数字、字符串等其他值。

locals 被赋值为一个非对象时抛出错误。

例如:

import { defineMiddleware } from "astro:middleware";
export const onRequest = defineMiddleware((context, next) => {
context.locals = 1541;
return next();
});
贡献

你有什么想法?

社区
京ICP备15031610号-99