Get the App
SLTechnology News&Howtos  ›  Development  › 

The method of uni-app subcontracting

Shulou Source: shulou.com Published: 2022-05-31 22:14:45 10月04日 Update

This article introduces the relevant knowledge of "the method of uni-app subcontracting". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Preface

The project needs uni-app development. Tell me what uni-app is. Uni-app, like the Trao framework, is used for multiterminal development.

What they have in common is that they can all be posted to IOS, Android, H5, and various Mini Program platforms (Wechat / Alipay / Baidu / Toutiao / QQ/ nails) and other platforms.

The difference is: uni-app it is based on the syntax of Vue to write 2 Trao it is written in the syntax of React.

Today, let's talk about how uni-app is subcontracted:

When we run the WeChat Mini Programs tool, Wechat's limited package restricts 2MB. If there are too many local pictures, the first thing we think of now is subcontracting processing. Take a look at the directory first.

1. Create a folder

2. Writing subPackages root in pages.json represents your main path. Path and pages are the same.

"subPackages": [/ / login authorization {"root": "pages/index", "pages": [{"path": "rename" "style": {"navigationBarTitleText": "Registration", "navigationBarBackgroundColor": "# 2E73FF", "navigationBarTextStyle": "white" "backgroundColor": "# 2E73FF"}, {"path": "faces" "style": {"navigationBarTitleText": "Registration", "navigationBarBackgroundColor": "# 2E73FF", "navigationBarTextStyle": "white" "backgroundColor": "# 2E73FF"}, {"path": "rzcg" "style": {"navigationBarTitleText": "Registration", "navigationBarBackgroundColor": "# 2E73FF", "navigationBarTextStyle": "white" "backgroundColor": "# 2E73FF"}, {"path": "ws" "style": {"navigationBarTitleText": "Registration", "navigationBarBackgroundColor": "# 2E73FF", "navigationBarTextStyle": "white" "backgroundColor": "# 2E73FF"}}]}]

3. Create a vue.config.js file under the root directory to write

Const path = require ('path') / / read file const CopyWebpackPlugin = require (' copy-webpack-plugin') / / copy module.exports = {configureWebpack: {plugins: [new CopyWebpackPlugin ([{from: path.join (_ _ dirname,'/ images'), / / where do you come from to: path.join (_ _ dirname+'/unpackage/') 'dist', process.env.NODE_ENV = =' production'? 'build':' dev', process.env.UNI_PLATFORM,'/ pages/') / / where to go}])}

4. Enter the command line npm I copy-webpack-plugin-- save-dev

5. Open Mini Program to see the configuration

6. Upload files

This is the end of the content of "the method of uni-app subcontracting". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Files programs methods content more knowledge grammar development different practical consistent successful learning and then different points representatives common ground preface command dilemma multiple Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Linux Apple Xiaomi NVidia