在egg.js中:
const UserSchema = new Schema({
userId: { type: String },
userName: { type: String },
userPwd: { type: String },
cartList: [
{
...goodsItem,
productNum:{
type:Number,
default:1
}
}
],
});
goodsItem.js
module.exports = goodsItem = {
productId: { type: String },
productName: { type: String },
salePrice: { type: Number },
productImage: { type: String },
}