FilterItem.vue
1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<template>
	<view class="filter-item">
		<view class="filter-title">
			<text>{{ title }}</text>
		</view>
		<view class="filter-list">
			<view v-for="(item, index) in filterList" :key="index" @click="radioClick(index)" :class="['tag-item', { checked: item.checked, 'mr-30': (index + 1) % 3 !== 0 }]">
				{{ item.name }}
			</view>
		</view>
	</view>
</template>
<script>
export default {
	props: {
		title: {
			type: String,
			default: ''
		},
		filterList: {
			type: Array,
			default: () => []
		}
	},
	methods: {
		radioClick(currentIndex) {
			this.$emit('clickTag', currentIndex);
		}
	}
};
</script>
<style lang="scss" scoped>
.filter-item {
	margin-top: 40rpx;
	.filter-title {
		color: #333;
		font-size: 14px;
		font-weight: 700;
	}
	.filter-list {
		display: flex;
		flex-wrap: wrap;
		.tag-item {
			margin-top: 30rpx;
			width: 210rpx;
			height: 68rpx;
			border-radius: 32rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			color: #333;
			font-size: 13px;
			border: 1px solid #fff;
			background-color: #f6f6f6;
		}
		.checked {
			border: 1px solid #377dff4d;
			background-color: #377dff0d;
			color: #377dffff;
		}
		.mr-30 {
			margin-right: 30rpx;
		}
	}
}
</style>