Chinaunix首页 | 论坛 | 博客
  • 博客访问: 930779
  • 博文数量: 210
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 2070
  • 用 户 组: 普通用户
  • 注册时间: 2014-11-19 21:54
文章分类

全部博文(210)

文章存档

2020年(2)

2019年(18)

2018年(27)

2017年(5)

2016年(53)

2015年(88)

2014年(17)

分类: 其他平台

2018-06-04 14:58:45

wxml:

点击(此处)折叠或打开

  1. <block wx:for="{{itemlist}}">
  2.             <view class='activety_con_box_item'>
  3.               <view class='item-img'>
  4.                 <image src='{{item.pic}}'></image>
  5.               </view>
  6.               <view class='author'>{{item.author}}</view>
  7.               <view class='description'>{{item.description}}</view>
  8.               <view class='choose'>
  9.                 <view class="choose_item {{current==item.user_id ?'active':'' }}" bindtap='choose' data-id="{{item.user_id}}">选择</view>
  10.               </view>
  11.             </view>
  12.           </block>
js:

点击(此处)折叠或打开

  1. data: {
  2.     current:null,
  3.     current1: null,
  4.     num :1,
  5.     itemlist:[
  6.       {
  7.         user_id:0,
  8.         pic:"/../img/yulan.jpg",
  9.         author: "小明",
  10.         description: "描述了一个小镇的安详情景"
  11.       },
  12.       {
  13.         user_id: 1,
  14.         pic: "/../img/yulan.jpg",
  15.         author: "小明",
  16.         description: "描述了一个小镇的安详情景"
  17.       },
  18.       
  19.     ]
  20.     

  21.   },
  22. choose1: function (e) {
  23.     var that = this;
  24.     // console.log(e.currentTarget.dataset.id)
  25.     that.setData({
  26.       current1: e.currentTarget.dataset.id
  27.     })
  28.   },
  29. //console.log(e)
  30. result==>
    1. Array(1)
      1. length:1
    2. currentTarget:
      1. id:""
      2. offsetLeft:242
      3. offsetTop:1013

阅读(1143) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~