Introduction of the useExtendedLib extension library
1. Add weUI plug-in in wechat public platform Settings
Settings -> Third-party Settings -> Plug-in Management -> Add plug-ins
2. Add the following content to the global app.json file
"useExtendedLib": {
"weui": true
},
Copy the code
3. Add the component name to the PAGE JSON file you want to reference (no need to import in WXSS)
{
"usingComponents": {
"mp-uploader": "weui-miniprogram/uploader/uploader"
}
}
Copy the code
4. Use it as a base component in WXML
<view>
<mp-uploader max-count="5"></mp-uploader>
</view>
Copy the code
Second, NPM construction
1, NPM init, the default press enter, will get package.json file
npm init
Copy the code
2. Install weUI dependencies
npm i weui-miniprogram -S --production
Copy the code
3. In developer Tools, go to Tools -> Build NPM and get a new folder miniProjram_npm
4. In developer Tools, choose Details > Local Settings > Select Use NPM module
5. Introduce the WeUI component library style in global app.wXSS
@import './miniprogram_npm/weui-miniprogram/weui-wxss/dist/style/weui.wxss';
Copy the code
6. Add the component name to the PAGE JSON file that you want to reference
{
"usingComponents": {
"mp-uploader": "weui-miniprogram/uploader/uploader"
}
}
Copy the code
7. Use it as a base component in WXML
<view>
<mp-uploader max-count="5"></mp-uploader>
</view>
Copy the code