query-item.vue 1.54 KB
<template>
	<view>
		<view class="popup-alarm-text"><text class="text">{{leftText}}</text></view>
		<view class="u-flex popup-alarm-child">
			<view v-for="(item, index) in queryStatus" :key="index" class="alarm-text" @click="currentClick(item,index)"
				:style="[index == currentIndex ? { hignLightColor } : { unHighlightColor }]">
				<text :class="[index == currentIndex ? 'select-text' : 'un-select-text']"
					class="text">{{ item.name }}</text>
			</view>
		</view>
		<view style="height:180rpx"></view>
	</view>
</template>

<script>
	export default {
		props: {
			leftText: String,
			queryStatus: Array
		},
		data() {
			return {
				currentIndex: 0,
			}
		},
		computed: {
			hignLightColor() {
				return `background: 'rgba(55, 125, 255, 0.05)', border: '1rpx solid rgba(55, 125, 255, 0.3)'`
			},
			unHighlightColor() {
				return `background: '#F6F6F6'`
			}
		},
		methods: {
			currentClick(item, index) {
				this.currentIndex = index
				this.$emit('currentClick', item, index)
			},
			reset() {
				this.currentIndex = 0
			}
		}
	}
</script>

<style lang="scss" scoped>
	.popup-alarm-text {
		width: 750rpx;
		margin-left: 14rpx;

		.text {
			color: #333333;
			font-size: 14px;
		}
	}

	.popup-alarm-child {
		margin-top: 15rpx;
		width: 750rpx;
		height: 60rpx;
		flex-wrap: wrap;
		margin-left: -10rpx;

		.alarm-text {
			margin: 25rpx;
			line-height: 50rpx;
			text-align: center;
			width: 180rpx;
			height: 60rpx;
			background-color: #f6f6f6;
			border-radius: 32px;

			.text {
				color: #333333;
				font-size: 13px;
			}
		}
	}
</style>