css实现订单类似右下角√钩选中

<div class="receiverInfo">
            <div class="receiverInfo-box" v-for="(item, index) in receiverInfo" :key="index"
                @click="toggleSelection(index)" :class="{ 'selected-box': selectedItem === index }">
                <span class="item">{{ item.name }}</span><br>
                <span class="item">{{ item.phone }}</span> <span class="address-button"><el-button size="mini"
                        @click="EditAddress">修改</el-button></span><br>
                <div class="item address-detail">{{ item.addressDetail }}</div>
            </div>
        </div>
.receiverInfo {
    width: 100%;
    height: 170px;
    /* background-color: pink; */
    text-align: start;
    display: flex;
}

.receiverInfo-box {
    width: 230px;
    height: 120px;
    border: 1px solid #c4c4c4;
    border-radius: 6px;
    margin-top: 20px;
    margin-left: 15px;
    padding: 10px;
    font-size: 14px;
}

.address-detail {
    margin-top: 25px;
}

.address-button {
    float: right;
}

/* 选中盒子样式 */
.selected-box {
    border: 1px solid #20a0ff;
    /* 设置选中时的边框样式 */
    /* 可以添加其他样式 */
    color: #20a0ff;
    position: relative;
    transition: all 0.5s ease;
}

.selected-box ::after {
    content: '✔';
    display: block;
    height: 0px;
    width: 0px;
    position: absolute;
    bottom: 0;
    right: 0;
    color: #fff;
    /**对号大小*/
    font-size: 10px;
    line-height: 8px;
    border: 10px solid;
    border-color: transparent #4884ff #4884ff transparent;
}
export default {
    data() {
        return {
            // 收货人信息
            receiverInfo: [{
                id: 1,
                name: '江小白',
                phone: '12256235623',
                address: '浙江省 杭州市 萧山区',
                addressDetail: '杭州市萧山区区西湖博览园',
            }, {
                id: 1,
                name: '江小白',
                phone: '12256235623',
                address: '浙江省 杭州市 萧山区',
                addressDetail: '杭州市萧山区区西湖博览园',
            }],
            selectedItem: null,
            dialogVisible: false,//编辑地址的弹窗
            form: {
                name: ''
            }
        }
    },
    methods: {
        toggleSelection(index) {
            console.log(index, '我选中box')
            // 切换选中状态
            this.selectedItem = this.selectedItem === index ? null : index;
        },
        // 修改地址
        EditAddress() {

        }
    }
}

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值