模型“问题”使用未知的mixin:时间

时间:2018-10-29 14:01:09

标签: javascript node.js rest loopbackjs mixins

我在回送v3应用程序中定义了一个mixin,但出现此错误:

Model "Question" uses unknown mixin: Time

model-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");
};

1 个答案:

答案 0 :(得分:0)

好。通过将mixin文件名更改为time.js(小写),将question.json中的mixin名称更改为“ Time”(大写),即可正常工作。