推荐关注
› Meteor
› JSLint - a JavaScript code quality tool
› jsFiddle
› D3.js
› WebStorm
推荐书目
› JavaScript 权威指南第 5 版
› Closure: The Definitive Guide
Poikilotherm

求助 小程序点击显示问题

  •  
  •   Poikilotherm · Mar 21, 2018 · 3881 views
    This topic created in 3160 days ago, the information mentioned may be changed or developed.

    wxml <block wx:for-items="{{item.body}}"> <view class="zw-dp-bodyparts-class {{(index+1)%3 == 0 ? "zw-mwt-rightborder" : ""}} {{activeIndex == index ? "zw-therapy-bgfontcolor" : ""}}" bindtap="therapy" id="{{index}}"> <view class="zw-dp-vertical"> <text class="zw-ty-part-font">{{item.parts}}</text> <text>{{item.price}}</text> </view> </view> </block>

    js therapy: function (e) { var activeIndex = e.currentTarget.id; console.log(activeIndex); this.setData({ activeIndex: activeIndex }); },

    点击效果显示不出来,是逻辑还有问题么

    2 replies  •  2018-03-21 14:19:41 +08:00
    digmon
    digmon
    Mar 21, 2018 via iPhone
    1
    data-id
    Poikilotherm
    Poikilotherm
    OP
    Mar 21, 2018
    2
    @digmon index 可以拿到 是我放在模板里没有传参 所以拿不到 activeIndex 了 谢谢哈
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2092 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 07:24 · PVG 15:24 · LAX 23:24 · JFK 02:24
    ♥ Do have faith in what you're doing.