当前位置:网站首页>Uni app advanced style framework / production environment
Uni app advanced style framework / production environment
2022-07-28 01:08:00 【Hua Weiyun】
Style framework

uni-UI The extension component complies with easycom Component specifications , It can be applied directly .
If the component does not conform to easycom standard , You need to manually import and register components in your code before using them .
uni app Of JS
uni app Of JS Code in H5 Run in the browser of the client . Not H5 End ( Including applets and Applications ),Android The platform runs on V8 In the engine ,IOS The platform runs on IOS Of jscore In the engine , No one runs in the browser or WebView in .
Not h5 End does not support windows、documents、navigator And so on JS API, But it also supports standards ECMAScript.
Do not put the browser's JS Extension objects are equivalent to standard JS.
uni app Non - h5 The end also supports standards JS、if、for Equal grammar 、 character string 、 Numbers 、 Time 、 Boolean value 、 Array 、 Custom object and other variable types and various processing methods . Only browser specific objects are supported , Such as window 、 Documents and navigator .
Promise
For asynchronous methods , If no callback parameter is passed in , Such as success、fail and complete, Then the data will be used as promise return . for example :uni getImageInfo()
The method is asynchronous , And there is a return object . If you want to get the return object , At least one callback parameter must be passed in , Such as success、fail、complete etc. .
// Normal use const task = uni.connectSocket( success(res){ console.log(res) } ) // Promise turn uni.connectSocket().then(res => { // Here is success Callback res // If you want to get task , Do not use Promise turn console.log(res) })Uni app Page routing is managed by the framework . Developers need to use JSON To configure the path and page style of each routing page ( Be similar to app.JSON Configure page routing applet in ).
"pages": [ { "path": "pages/index", "style": { "navigationBarTitleText": " Jinxun Education · Routing configuration ", "navigationBarBackgroundColor": "#FFFFFF", "navigationBarTextStyle": "black", "backgroundColor": "#FFFFFF", "enablePullDownRefresh": true } }, { "path": "pages/user", "style": { "navigationBarTitleText": " Jinxun Education · Routing configuration ", "navigationBarBackgroundColor": "#FFFFFF", "navigationBarTextStyle": "black", "backgroundColor": "#FFFFFF", "enablePullDownRefresh": true } }] Due to the size of the applet and resource loading limitations , Each applet platform provides a subcontracting method to optimize the download and startup speed of the applet .
The so-called main package is to place the default startup page /tabbar page , All subcontracting requires some common resources /js Script ; Subcontracting is based on page JSON To configure .
Production environment
if(process.env.NODE_ENV === 'development'){ console.log(' development environment ')}else{ console.log(' Production environment ')}边栏推荐
猜你喜欢

Jointly create a new chapter in cultural tourism | xinqidian signs a strategic cooperation agreement with Guohua cultural tourism

Postman 的使用
![[proteus simulation] 51 single chip microcomputer washing machine simulation control program](/img/a1/d4256a5e350078b791c0b5cd512fe3.png)
[proteus simulation] 51 single chip microcomputer washing machine simulation control program

芯片行业常用英文术语最详细总结(图文快速掌握)

Srv6 debut

110. SAP UI5 FileUploader 控件深入介绍 - 为什么需要一个隐藏的 iframe

LSB steganography
![Leetcode:1997. the first day after visiting all rooms [jump DP]](/img/6e/52d5871a11d1b27e673112a8245b28.png)
Leetcode:1997. the first day after visiting all rooms [jump DP]

《KMP复习 + AC自动机》前传

Use of postman
随机推荐
Oracle错误: ORA-01722 无效数字
估值360亿美元!即将进行首次载人发射的SpaceX筹资3.46亿美元
[STM32] watchdog module
网络设备硬核技术内幕 防火墙与安全网关篇 (七) 虚拟化神器 (上)
CAP的理解
Maximize activation
Analysis and recurrence of network security vulnerabilities
[original] [crawler series] briefly get the most popular topics, related topics and description information
进程与进程调度
Cross desktop web container evolution
福特SUV版“野马”正式下线,安全、舒适一个不落
Ford SUV "Mustang" officially went offline, safe and comfortable
网络设备硬核技术内幕 防火墙与安全网关篇 (九) 虚拟化神器 (下)
Leetcode:1997. the first day after visiting all rooms [jump DP]
Red team killer behinder_ V4.0 (ice scorpion 4.0)
Branch and loop sentence exercises
Storage of deep planing data in memory
Examples of application of JMeter in performance testing
7. Typescript part Foundation
Srv6 debut