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

求助 小程序点击显示问题

  •  
  •   Poikilotherm · Mar 21, 2018 · 3559 views
    This topic created in 3009 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
        1
    digmon  
       Mar 21, 2018 via iPhone
    data-id
    Poikilotherm
        2
    Poikilotherm  
    OP
       Mar 21, 2018
    @digmon index 可以拿到 是我放在模板里没有传参 所以拿不到 activeIndex 了 谢谢哈
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5322 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 08:24 · PVG 16:24 · LAX 01:24 · JFK 04:24
    ♥ Do have faith in what you're doing.