我的安装流程
在小程序目录下cnpm install --save miniprogram-recycle-view
然后在开发工具点击工具 ==> 构建npm
之后就是在需要的页面json中引入
{
"usingComponents": {
"recycle-view": "miniprogram_npm/miniprogram-recycle-view/recycle-view",
"recycle-item": "miniprogram_npm/miniprogram-recycle-view/recycle-item"
}
}
最后在js中
createRecycleContext = require('miniprogram-recycle-view')
然后就报错VM419 WAService.js:22 Uncaught Error: module "pages/tickets_apply/miniprogram-recycle-view.js" is not defined
createRecycleContext = require('miniprogram-recycle-view') 前面别忘了加 +++++ const
"usingComponents": {
"recycle-view": "miniprogram-recycle-view/recycle-view",
"recycle-item": "miniprogram-recycle-view/recycle-item"
}
"usingComponents": {
"recycle-view": "../../miniprogram_npm/miniprogram-recycle-view/recycle-view",
"recycle-item": "../../miniprogram_npm/miniprogram-recycle-view/recycle-item"
}
为什么要写成 miniprogram_npm/miniprogram-recycle-view/recycle-view ???