在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
index.wxml <block wx:for="{{demoData}}" wx:for-item="item" wx:for-index="idx"> <view class="demos"> <view><text>测试的时间:</text><text>{{item.demoTime}}</text></view> <view><text>测试的内容:</text><text>{{item.demoCon}}</text></view> </view> </block> <view class="btn" catchtap="anniu">追加的按钮</view> index.js Page({ data: { demoData: [ { demoTime: "2017-2-6", demoCon: '我是测试代码001' }, { demoTime: "2017-8-6", demoCon: '我是测试代码002' } ] }, onLoad: function () { this.setData({ nowDate: util.formatTime(new Date()) }); }, anniu:function(){ var zhuijia = {demoTime: "2017-7-7", demoCon: '我是追加的测试代码'}; this.data.demoData.unshift(zhuijia); this.setData({ demoData: this.data.demoData }); } }) index.wxss .demos{ width: 100%; height: 100px; line-height: 50px; background-color: #188eee; color: #fff; margin: 10px 0px; } .btn{ height: 50px; width: 80%; margin-left: 10%; line-height: 50px; background-color:orangered; color: #fff; text-align: center; }
|
请发表评论