You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<template> <view class="pageBg"> <view class="pad"> <view class="type"> <view class="h1">驾照类型</view> <view class="tagFlex"> <view class="tab" v-for="(item,index) in tagList" :class="{active: driverTypeArr.indexOf(item.id)!=-1}" @click="driverTypeClick(item)">{{ item.text }}</view> </view> </view> <view class="region"> <view class="h1">区域</view> </view> <view class="btn_row"> <view class="btn border" @click="reSetFn">重置</view> <view class="btn">确定</view> </view> </view> </view> </template>
<script> export default { data() { return { tagList: [ {text: '名称', id: 1}, {text: '名称', id: 2}, {text: '名称', id: 3}, ], driverTypeArr: [] } }, methods: { driverTypeClick(item) { let index = this.driverTypeArr.indexOf(item.id) if( index==-1) { this.driverTypeArr.push(item.id) }else { this.driverTypeArr.splice(index,1) } console.log(index) console.log(this.driverTypeArr) }, reSetFn() { } } } </script>
<style lang="scss" scoped> .h1 { line-height: 100rpx; } .btn_row { position: fixed; bottom: 50rpx; left: 0; display: flex; justify-content: space-between; width: 100%; padding: 0 28rpx; .btn { width: 48.8%; height: 72rpx; background: #1989FA; border-radius: 8rpx; font-size: 28rpx; color: #fff; text-align: center; line-height: 72rpx; &.border { background: rgba(25,137,250,0.1); border: 2rpx solid #1989FA; color: $themC; } } } .tagFlex { display: flex; flex-wrap: wrap; .tab { padding: 10rpx 24rpx; margin: 12rpx 20rpx; height: 60rpx; background: #FFFFFF; border-radius: 8rpx; font-size: 28rpx; color: #686B73; &.active { background: rgba(25,137,250,0.1); border-radius: 8rpx; border: 2rpx solid #1989FA; font-size: 28rpx; color: $themC; } } } </style>
|