<template>
	<view class="container">
		<view class="tabs">
			<view
				class="title-view"
				v-for="(item, index) in title"
				@click="changeActiveIndex(index)"
				:class="{isActive: activeIndex === index}"
			>
				<text>{{item}}</text>
				<!-- <text>{{index}}</text> -->
				<view class="arrow" v-if="activeIndex !== index">
					<u-image src="/static/dropdown/dp_icon_lxia.png" width="14rpx" height="11rpx"/>
				</view>
				<view class="arrow" v-if="activeIndex === index">
					<u-image src="/static/dropdown/dp_icon_hlxia.png" width="14rpx" height="11rpx"/>
				</view>
				
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		name:"DropDown",
		data() {
			return {
				title: ['行业','区域','面积','筛选'],
				activeIndex: -1
			};
		},
		methods: {
			changeActiveIndex(index){
				if(this.activeIndex === index){
					this.activeIndex = -1;
				}
				this.activeIndex = index
			}
		}
	}
</script>

<style lang="scss" scoped>
	.isActive{
		color: #CC3333;
	}
	.container{
		
		.tabs{
			background-color: #fff;
			height: 100rpx;
			display: flex;
			justify-content: space-around;
		}
		.title-view {
			display: flex;
			>text {
				font-size: 14px;
				display: flex;
				flex-direction: column;
				justify-content: center;
			}
		}
		.arrow {
			margin-left: 8rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
		}
	}
	
</style>