当前位置:网站首页>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('生产环境')}边栏推荐
- 数组相关知识
- LeetCode_ Bit operation_ Medium_ 137. Number II that appears only once
- 深度刨析数据在内存中的存储
- 小波变换学习笔记
- 计算属性的基本使用
- 跨桌面端Web容器演进
- 《KMP复习 + AC自动机》前传
- Jerry Zhi has problems in real-time adjustment of sound change effect in magic sound mode [chapter]
- Rendering problems
- Network equipment hard core technology insider firewall and security gateway (12) the mystery of zero contact office
猜你喜欢
![[BuildRelease Management]Parabuild](/img/80/11c2b539c217ecd6ba55668d3e71e9.png)
[BuildRelease Management]Parabuild
![[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

共创文旅新篇章|新起典与国华文旅签订战略合作协议

Postman download and use tutorial

Syntaxerror resolved: positive argument follows keyword argument

Basic operations of MySQL database (2) --- Based on data table

多线程及多线程程序的编写

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

Data analysis: disassembly method (details)

Postman下载、使用教程
随机推荐
Network device hard core technology insider firewall and security gateway (10)
Programmer growth Chapter 30: do you really understand feedback?
SRv6初登场
推荐系统-模型(三):精排模型【LR、GBDT、Wide&Deep、DCN、DIN、DIEN、MMOE、PLE】
C语言程序设计 | offsetof宏的讲解及其模拟实现
Scrollview, tableview nested solutions
接口测试实战项目02:读懂接口测试文档,上手操练
《KMP复习 + AC自动机》前传
Solve maze problem recursively
Function related knowledge
Can TSMC Samsung build a production line without American equipment for Huawei?
融云 IM & RTC 能力上新盘点
Count the six weapons of the domestic interface cooperation platform!
Logic of automatic reasoning 07 - predicate calculus
Jerry caused other messages to accumulate in the message pool [article]
小波变换学习笔记
Network device hard core technology insider firewall and security gateway (VIII) virtualization artifact (middle)
[introduction to C language] zzulioj 1026-1030
共创文旅新篇章|新起典与国华文旅签订战略合作协议
Iperf installation and use