Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of uni-app subcontracting

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report