当前位置:网站首页>uni-app进阶之样式框架/生产环境
uni-app进阶之样式框架/生产环境
2022-07-27 22:33:00 【华为云】
样式框架

uni-UI扩展组件符合easycom组件规范,可以直接应用。
如果组件不符合easycom规范,则需要在使用之前在代码中手动导入并注册组件。
uni app的JS
uni app的JS代码在H5端的浏览器中运行。非H5端(包括小程序和应用程序),Android平台运行在V8引擎中,IOS平台运行在IOS的jscore引擎中,没有一个运行在浏览器或WebView中。
非h5端不支持windows、documents、navigator等浏览器的JS API,但也支持标准ECMAScript。
不要将浏览器的JS扩展对象等同于标准JS。
uni app的非h5端还支持标准JS、if、for等语法、字符串、数字、时间、布尔值、数组、自定义对象等变量类型和各种处理方法。仅支持特定于浏览器的对象,如窗口、文档和导航器。
Promise
对于异步方法,如果没有传入回调参数,如success、fail和complete,那么数据将作为promise返回。例如:uni getImageInfo()
该方法是异步的,并且有一个返回对象。如果要获取返回对象,必须传入至少一个回调参数,如success、fail、complete等。
// 正常使用 const task = uni.connectSocket( success(res){ console.log(res) } ) // Promise 化 uni.connectSocket().then(res => { // 此处即为 success 回调的 res // 如果想获取 task ,则不要使用 Promise 化 console.log(res) })Uni app页面路由均由框架管理。开发人员需要使用JSON来配置每个路由页面的路径和页面样式(类似于app.JSON中配置页面路由的小程序)。
"pages": [ { "path": "pages/index", "style": { "navigationBarTitleText": "金迅教育 · 路由配置", "navigationBarBackgroundColor": "#FFFFFF", "navigationBarTextStyle": "black", "backgroundColor": "#FFFFFF", "enablePullDownRefresh": true } }, { "path": "pages/user", "style": { "navigationBarTitleText": "金迅教育 · 路由配置", "navigationBarBackgroundColor": "#FFFFFF", "navigationBarTextStyle": "black", "backgroundColor": "#FFFFFF", "enablePullDownRefresh": true } }]由于小程序的大小和资源加载限制,每个小程序平台都提供了一种分包方法来优化小程序的下载和启动速度。
所谓主包就是放置默认的启动页面/tabbar页面,所有分包都需要一些公共资源/js脚本;分包基于页面JSON配置。
生产环境
if(process.env.NODE_ENV === 'development'){ console.log('开发环境')}else{ console.log('生产环境')}边栏推荐
- Syntaxerror resolved: positive argument follows keyword argument
- 共创文旅新篇章|新起典与国华文旅签订战略合作协议
- Recommendation system model: wide & deep model
- 至少42名员工感染新冠病毒!诺基亚宣布关闭印度电信设备工厂
- Basic operations of MySQL database (3) --- Based on fields
- Recommended system - indicators: CTR, CVR
- 红队大杀器 Behinder_v4.0(冰蝎4.0)
- c# 反射之Type使用
- Network device hard core technology insider firewall and security gateway (10)
- Database daily question --- day 22: last login
猜你喜欢

Data analysis: disassembly method (details)

LSB steganography

分支和循环语句题目练习

Postman 的使用

激活最大化

《KMP复习 + AC自动机》前传
![[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

One year anniversary of creation, Chongba young Lang

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

Basic operations of MySQL database (3) --- Based on fields
随机推荐
接口测试实战项目02:读懂接口测试文档,上手操练
[BuildRelease Management]Parabuild
leetcode:1997. 访问完所有房间的第一天【跳跃dp】
startUMl
When Jerry made a phone call, recording to SD card /u disk was not enough [article]
Red team killer behinder_ V4.0 (ice scorpion 4.0)
Border width border fillet border color
Jerry, if you turn on Bluetooth again, one for two. When the mobile phone is connected to the prototype, it will appear and cannot be connected [chapter]
函数相关知识
Jerry caused other messages to accumulate in the message pool [article]
Wavelet transform learning notes
Logic of automatic reasoning 09 - automatic theorem proving
[proteus simulation] 51 single chip microcomputer washing machine simulation control program
Jerry's prompt sound processing when switching devices [chapter]
Add a picture in front of the cell
Network equipment hard core technology insider firewall and security gateway (11) secrets of zero contact office
Multithreading & high concurrency (the latest in the whole network: interview questions + map + Notes) the interviewer is calm
网络设备硬核技术内幕 防火墙与安全网关篇 (九) 虚拟化神器 (下)
MySQL limit usage and large paging problem solving
[CruiseControl]Build Result JSP