dynamic-border.uvue 1.0 KB
Newer Older
1 2 3
<template>
	<view style="margin: 15px;border-radius: 10px;background-color: white;">
		<view
4
			v-for="index in 10" :key="index"
5 6 7 8 9
			:class="(index < 9 ? 'bb1' : '') + ' ' + (currentIndex == 0 ? 'btlr10 btrr10' : currentIndex == 9 ? 'bblr10 bbrr10' : '')"
			style="flex-direction: row;align-items: center;padding: 15px"
			:style="index == currentIndex ? 'background-color :#57BE6A;' : ''"
			@tap="currentIndex = index">
			<view>
10
				<text style="font-size: 14px;" :style="index == currentIndex ? 'color: #FFFFFF;' : ''">{{ index }}</text>
11 12 13 14 15 16 17 18 19
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
20
				currentIndex: 1,
21
			}
22 23 24 25 26 27
		},
    methods: {
      changeIndex(index: number) {
        this.currentIndex = index
      }
    }
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
	}
</script>

<style>
	.bb1{
		border-bottom: 1rpx solid #EEEEEE;
	}
	.btlr10{
		border-top-left-radius: 10rpx;
	}
	.btrr10{
		border-top-right-radius: 10rpx;
	}
	.bblr10{
		border-bottom-left-radius: 10rpx;
	}
	.bbrr10{
		border-bottom-right-radius: 10rpx;
	}
</style>