Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试在服务器上的猫鼬模型中使用 lodash,_.pluck(...)但我收到“ReferenceError: _ is not defined”。
_.pluck(...)
根据我的阅读, lodash 包含在MeanJS中。我有什么特别需要做的吗?
大概你需要像任何其他模块一样需要它。我在 MEAN.JS 源代码中搜索了“lodash”,这出现了好几次:
var _ = require('lodash');
试一试。
它默认包含在 MEAN.JS 项目中。生成示例应用程序并查看使用示例。
var mongoose = require('mongoose'), Article = mongoose.model('Article'), _ = require('lodash');`