| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <template>
- <view class="tab-title">
- <view
- v-for="(item, index) in tabList"
- :key="index"
- class="tab-item"
- v-text="item"
- :class="index === pickTabIndex ? 'active' : ''"
- @click="changeChartsTab(index)"
- ></view>
- </view>
- </template>
- <script>
- export default {
- name: 'TabTile',
- props: {
- tabList: {
- type: Array,
- default: () => {
- return []
- }
- },
- active: {
- type: Number,
- default: 0
- }
- },
- data () {
- return {
- pickTabIndex: this.active
- }
- },
- watch: {
- pickTabIndex: function (val) {
- this.$emit('change', val)
- }
- },
- methods: {
- changeChartsTab (index) {
- this.pickTabIndex = index
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .tab-title {
- display: flex;
- height: 82rpx;
- line-height: 82rpx;
- background-color: #ffffff;
- border-bottom: 1px solid #f2f2f2;
- .tab-item {
- flex: 1;
- text-align: center;
- font-size: 32rpx;
- color: $uni-text-color-grey;
- }
- .tab-item.active {
- color: $j-primary-border-green;
- border-bottom: 1px solid $j-primary-border-green;
- }
- }
- </style>
|