73 lines
1.4 KiB
Vue
73 lines
1.4 KiB
Vue
<script>
|
|
export default {
|
|
name: "SubSection",
|
|
props: {
|
|
current: { // 当前选中
|
|
type: Number,
|
|
default: 0
|
|
},
|
|
canUse: { // 可用
|
|
type: [String, Number],
|
|
default: 0
|
|
},
|
|
notUse: { // 不可用
|
|
type: [String, Number],
|
|
default: 0
|
|
},
|
|
radioModel: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
index: 0
|
|
}
|
|
},
|
|
mounted() {
|
|
this.index = this.current
|
|
},
|
|
methods: {
|
|
change(index) {
|
|
this.index = index
|
|
this.$emit('change', index)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<view class="sub-section flex">
|
|
<view class="sub-section__item flex jc-center ai-center" :class="{'sub-section__active':index===0}"
|
|
@click="change(0)">
|
|
可使用 ({{ canUse }})
|
|
</view>
|
|
<view class="sub-section__item flex jc-center ai-center" :class="{'sub-section__active':index===1}"
|
|
@click="change(1)">
|
|
{{radioModel?'不可用':'已到期'}} ({{ notUse }})
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<style scoped lang="less">
|
|
.sub-section {
|
|
width: 686rpx;
|
|
height: 80rpx;
|
|
box-sizing: border-box;
|
|
border: 2rpx solid #FF564A;
|
|
border-radius: 4rpx;
|
|
font-size: 32rpx;
|
|
|
|
.sub-section__item {
|
|
width: 50%;
|
|
background: #FFFFFF;
|
|
color: #333333;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.sub-section__active {
|
|
background: #FF564A;
|
|
color: #FFFFFF;
|
|
}
|
|
}
|
|
</style> |