微信小程序----组件之text
来源:互联网 发布:高中封闭式管理 知乎 编辑:程序博客网 时间:2024/06/05 06:59
文档地址:https://mp.weixin.qq.com/debug/wxadoc/dev/component/
源码下载:
http://download.csdn.net/download/zhaihaohao1/9962142
根据文档写代码
效果图:
项目结构:
核心代码:
index.wxml
<view class="btn-area"> <view class="body-view"> <text>{{text}}</text> <button bindtap="add">add line</button> <button bindtap="remove">remove line</button> </view></view>index.wxss
.btn-area{ background-color: yellow;}.body-view{ background-color: green;}index.js
var initData = 'this is first line\nthis is second line'var extraLine = [];Page({ /** * 页面的初始数据 */ data: { text: initData }, add: function (e) { extraLine.push('other line') this.setData({ text: initData + '\n' + extraLine.join('\n') }) }, remove: function (e) { if (extraLine.length > 0) { extraLine.pop() this.setData({ text: initData + '\n' + extraLine.join('\n') }) } }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }})
源码下载:
http://download.csdn.net/download/zhaihaohao1/9962142
阅读全文
0 0
- 微信小程序----组件之text
- 微信小程序----组件之rich-text
- 微信小程序学习(五)之text组件
- 微信小程序--text组件学习
- 微信小程序把玩(十二)text组件
- 微信小程序学习(8)-text组件
- 微信小程序组件(四)text
- 2.2.2微信小程序内容组件 text(文本)
- UGUI之Text组件详解
- React Native组件之Text
- 微信小程序之组件学习
- 微信小程序----组件之view
- 微信小程序----组件之swiper
- 微信小程序----组件之progress
- 微信小程序----组件之icon
- 微信小程序----组件之button
- 微信小程序----组件之checkbox
- 微信小程序----组件之form
- Python中的协程和异步编程
- 成为快乐高产的程序员的小诀窍。
- 安装
- 机器学习之非监督学习
- AbstractQueuedSynchronizer源码剖析(四)- 不响应中断的共享锁
- 微信小程序----组件之text
- HDU6186CS Course前缀和
- html5播放器的示例代码
- 如何在linux下开启FTP服务
- startActivity时报错Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVI
- [机器学习实验4]正则化(引入惩罚因子)
- 《重构-改善既有代码的设计》知识精选——代码坏味道
- 2017智慧树 创践大学生创新创业实务答案
- Wdatepicker日期控件的使用指南