当前位置:网站首页>uni-app进阶之创建组件/原生渲染
uni-app进阶之创建组件/原生渲染
2022-07-28 09:54:00 【华为云】
为了提高开发效率,hbuilderx将常见的uni app代码封装到以u开头的代码块中。如果在模板标记中输入ulist,将自动生成以下代码:
<view class="uni-list"> <view class="uni-list-cell"> <view class="uni-list-cell-navigate uni-navigate-right" v-for="(item,index) in list" :key="index"> {{item.value}} </view> </view></view>几乎所有组件,无论是内置的还是uni-UI,都已封装为代码块。在hbuilderx的Vue代码模板区域中单击u,代码助手将提示所有可见的列表。您还可以查看hbuilderx菜单工具-代码块设置-vue代码块左侧列表中的所有代码。
使用 Chrome 调试 H5
设置定时器:
//选择适合需求的定时器this.timer = setTimeout( () => { // 这里添加您的逻辑 }, 1000)this.timer = setInterval( () => { // 同上 }, 1000)进入uni app项目,单击工具栏中的Run->Run to browser->select chrome将uni app运行到浏览器。您可以参考运行uni应用程序。在浏览器上运行uni应用程序后,您可以像普通web项目一样进行预览和调试。
单击chrome控制台的sources列以调试JS断点。
在页面下的网页包中找到项目目录,直接找到对应的Vue页面进行断点调试;或按ctrl+p搜索文件名,进入调试页面;您也可以单击控制台上的日志信息,进入相应的页面进行调试。

原生渲染的视图层
在app nvue中,折扣也存在。react native中也存在此问题。Weex发明了bindingx机制,它可以在JS中将表达式传递给本机,然后在本机解析后根据指令操作视图层。这项技术也可以在uni app中使用。
作为一个表达式,bindingx不如JS强大,但可以实现基本的手势监控和动画。例如,当uni UI的swiperaction组件在app nvue下运行时,bindingx将自动启用以实现平滑跟踪。
对于复杂页面,更新某个区域的数据时,需要将该区域制作成一个组件,因此更新数据时只更新该组件,否则会更新整个页面的数据,导致点击延迟。这是自定义组件编译模式的特点。产生差异的原因是小程序当前仅提供组件差异更新机制,无法自动计算所有页面差异。
代码块分为标记代码块和JS代码块。如果在脚本标记中输入ushowtoast-enter,将自动生成以下代码:
uni.showToast({ title: '', mask: false duration: 1500});onUnload如下:
onUnload() { if(this.timer) { clearTimeout(this.timer); this.timer = null; } }边栏推荐
- Xiao Hei stands up again and looks at leetcode:653. Sum of two IV - enter BST
- Plato Farm-以柏拉图为目标的农场元宇宙游戏
- 软件设计师考前20问,注意啦!!
- Seektiger eco pass STI new progress, log in to ZB on April 14
- In retaliation for the dismissal of the company, I changed all code comments of the project!
- [openharmony] [rk2206] build openharmony compiler (2)
- Digital construction of pharmaceutical industry is on the verge
- 图解 3 种主流企业架构模式(建议收藏!)
- Thinking and summary of technical personnel | R & D Efficiency
- Read Plato farm's eplato and the reason for its high premium
猜你喜欢

2022-uni-app解析token标准的方式-使用jsrsasign-爬坑过了

OSPF expansion configuration, routing principles, anti ring and re release

Plato Farm-以柏拉图为目标的农场元宇宙游戏

Time series analysis 41 - time series prediction tbats model

软件设计师考前20问,注意啦!!

高温天气筑牢安全生产防线,广州海珠区开展加油站应急演练

ES (8.1) certification topic

LSA and optimization of OSPF
![[esp32][esp idf] ap+sta realizes wireless bridging and transferring WiFi signals](/img/bf/0a968064a8f7c11b86a2a2820208e6.png)
[esp32][esp idf] ap+sta realizes wireless bridging and transferring WiFi signals

In hot weather, the line of defense for safe production was strengthened, and Guangzhou Haizhu District carried out emergency drills for gas stations
随机推荐
Installing MySQL for Linux operating system (centos7)
手机号,固话正则表达式
Experiment 4 uses fdisk to manage hard disk
OSPF expansion configuration, routing principles, anti ring and re release
PHP 基础
Introduction to evaluatorfilter
二维前缀和
13 probability distributions that must be understood in deep learning
SeekTiger生态通证STI 新进展,4月14日登录 ZB
Description of landingsite electronic label quppa firmware entering DFU status
Basic examples that must be mastered by beginners of C #
[OpenHarmony] [RK2206] 构建OpenHarmony编译器 (二)
MySQL 为什么有时候会选错索引?
深度学习必懂的 13 种概率分布
How PHP gets the interface
(10) Defer keyword
include 与 require include_once 与 require_once 的区别
我用小程序容器让移动研发效率提升了5倍!
PHP connection MySQL native code
Xiao Hei stands up again and looks at leetcode:653. Sum of two IV - enter BST