微信小程序开发笔记
2021/11/30 14:07:01
本文主要是介绍微信小程序开发笔记,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1. 修改data中的数据
this.setData({ msg:'Sakura' })
控制台输出data中的数据
console.log(this.data.msg)
2. 绑定事件 bindxxx 是不阻止冒泡事件绑定 catchxxx 是阻止冒泡事件绑定
<!-- tap是点击事件 --> <view class="goStudy" bindtap="clickParent"> <text bindtap="clickChild">hello world</text> </view>
<!-- tap是点击事件 --> <view class="goStudy" catchtap="clickParent"> <text catchtap="clickChild">hello world</text> </view>
事件函数写在js中,与data平级
// 事件回调函数 clickParent(){ console.log('clickParent') }, clickChild(){ console.log('clickChild') },
这篇关于微信小程序开发笔记的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-10-04微信小程序如何实现点击图片查看大图功能-icode9专业技术文章分享
- 2024-09-28uniapp 小程序获取到数据库的换行符怎么展示-icode9专业技术文章分享
- 2024-09-20微信小程序全栈项目实战:从零开始的全面指南
- 2024-09-20微信小程序项目实战:零基础入门教程
- 2024-09-19微信小程序项目中miniprogram_npm文件跟node_modules文件的差别-icode9专业技术文章分享
- 2024-08-27小程序 单行显示,超出部分省略号显示的方法代码-icode9专业技术文章分享
- 2024-08-27微信小程序如何获取到特种设备的刘海屏高度-icode9专业技术文章分享
- 2024-08-27微信小程序如何获取苹果手机底部一横线高度信息方法代码-icode9专业技术文章分享
- 2024-08-27微信小程序 顶部状态栏标签背景为none但还是看不到状态栏什么原因-icode9专业技术文章分享
- 2024-08-21微信小程序全栈入门:从零开始的一站式指南