0
点赞
收藏
分享

微信扫一扫

《统计学习方法:李航》笔记 从原理到实现(基于python)-- 第6章 逻辑斯谛回归与最大熵模型(1)6.1 逻辑斯谛回归模型

上一篇

index.wxml

<view class="Area">
    <!-- {{activeNum===index?'Active':''}}是选择性添加类名进行渲染 -->
    <view wx:for="{{4}}" wx:key="*this" bind:tap="onClick" mark:index="{{index}}" class="List {{activeNum===index?'Active':''}}">
            {{item}}
    </view>
</view>

index.wxss

page{
    background-color: floralwhite;
}

.Area{
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
}

.List{
    text-align: center;
    margin: 10rpx 0rpx;
    padding: 20rpx 160rpx;
    background-color: gray;
    border-radius: 30rpx;
}

.Active{
    background-color: pink;
}

index.js


Page({
    data:{
        activeNum:0
    },

    onClick(e){
        //解构参数
        const {index}=e.mark

        this.setData({//参数赋值
            activeNum:index
        })
    }
})

在这里插入图片描述

举报

相关推荐

0 条评论