模型 "Question" 使用未知混合:时间
Model "Question" uses unknown mixin: Time
我在我的 loopback v3 应用程序中定义了一个 mixin,但我收到了这个错误:
Model "Question" uses unknown mixin: Time
型号-config.json :
"mixins": [
"loopback/common/mixins",
"loopback/server/mixins",
"../common/mixins",
"./mixins"
]
question.json :
"mixins": {
"Time": {
"arg":"text"
}
}
我的mixin文件名:
Time.js (in ./common/mixins folder)
Time.js代码:
'use strict';
module.exports = function (Model, options) {
console.log("OK");
};
Ok.By 将 mixin 文件名更改为 time.js(小写)并将 question.json 中的 mixin 名称更改为 "Time"(大写)它完美地工作。
我在我的 loopback v3 应用程序中定义了一个 mixin,但我收到了这个错误:
Model "Question" uses unknown mixin: Time
型号-config.json :
"mixins": [
"loopback/common/mixins",
"loopback/server/mixins",
"../common/mixins",
"./mixins"
]
question.json :
"mixins": {
"Time": {
"arg":"text"
}
}
我的mixin文件名:
Time.js (in ./common/mixins folder)
Time.js代码:
'use strict';
module.exports = function (Model, options) {
console.log("OK");
};
Ok.By 将 mixin 文件名更改为 time.js(小写)并将 question.json 中的 mixin 名称更改为 "Time"(大写)它完美地工作。