当前位置:网站首页>uni-app进阶之创建组件/原生渲染【day9】
uni-app进阶之创建组件/原生渲染【day9】
2022-07-31 05:10: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;
}
}
边栏推荐
- ES source code API call link source code analysis
- Distributed Transactions - Introduction to Distributed Transactions, Distributed Transaction Framework Seata (AT Mode, Tcc Mode, Tcc Vs AT), Distributed Transactions - MQ
- 如何将项目部署到服务器上(全套教程)
- With MVC, why DDD?
- Simple command of mysql
- Goodbye to the cumbersome Excel, mastering data analysis and processing technology depends on it
- numpy和pytorch中的元素拼接操作:stack,concatenat,cat
- 第7章 网络层第3次练习题答案(第三版)
- Anaconda configure environment directives
- Redis的初识
猜你喜欢

Interview Redis High Reliability | Master-Slave Mode, Sentinel Mode, Cluster Cluster Mode

Distributed Transactions - Introduction to Distributed Transactions, Distributed Transaction Framework Seata (AT Mode, Tcc Mode, Tcc Vs AT), Distributed Transactions - MQ

运用flask框架发送短信验证码的流程及具体代码

Apache DButils使用注意事项--with modifiers “public“
uni-app进阶之生命周期【day8】

If the account number or password is entered incorrectly for many times, the account will be banned.

ES source code API call link source code analysis

精解四大集合框架:List 核心知识总结

Object Detection Study Notes

数据库上机实验5 数据库安全性
随机推荐
【一起学Rust】Rust的Hello Rust详细解析
Flink sink redis writes to Redis
MySQL-Explain详解
【MQ我可以讲一个小时】
Interviewer: If the order is not paid within 30 minutes, it will be automatically canceled. How to do this?
【C语言趣味小游戏——猜数字】
Temporal对比Cadence
联盟链的真实场景在哪里
详解扫雷游戏(C语言)
2022-07-30:以下go语言代码输出什么?A:[]byte{} []byte;B:[]byte{} []uint8;C:[]uint8{} []byte;D:[]uin8{} []uint8。
数据库学习笔记
Kubernetes 证书可用年限修改
对list集合进行分页,并将数据显示在页面中
质量小议12 -- 以测代评
【LeetCode-SQL每日一练】——2. 第二高的薪水
ES source code API call link source code analysis
剑指offer基础版--- 第23天
MYSQL一站式学习,看完即学完
数据库上机实验6 数据库完整性
剑指offer专项突击版 --- 第 4 天