123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <template>
- <view :style="`${show ? 'overflow-x: auto;' :'overflow: hidden;'}`" class="scroll">
- <view @click="cutItem(item,index)" class="scroll-item" v-for="(item,index) in list" :key="index">
- <view class="">
- {{item}}
- </view>
- <!-- <view class="">
- {{item.semester}}
- </view> -->
- <view v-if="index == active" class="scroll-item-color">
- </view>
- </view>
- <view v-if="!show" class="scroll-text">
- <view class="scroll-text-left">
- </view>
- <view class="scroll-text-right">
- 成为VIP查看历史成绩
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: "scrollWeel\k",
- props: {
- list: {
- type: Array,
- default: () => []
- },
- show: {
- type: Boolean,
- default: () => true
- }
- },
- data() {
- return {
- active: 0
- };
- },
- methods: {
- cutItem(item, index) {
- this.active = index
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- ::-webkit-scrollbar {
- width: 0 !important;
- height: 0 !important;
- display: none;
- }
- .scroll {
- width: 100%;
- height: 100rpx;
- background-color: #fff;
- display: flex;
- overflow-x: auto;
- position: relative;
- .scroll-text {
- position: absolute;
- left: 0;
- height: 100%;
- display: flex;
- width: 100%;
- color: #fff;
- .scroll-text-left {
- width: 222rpx;
- }
- .scroll-text-right {
- flex: 1;
- background-color: rgba(183, 183, 183, 0.92);
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- }
- }
- .scroll-item {
- display: flex;
- flex-direction: column;
- flex-shrink: 0;
- width: 140rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- position: relative;
- .scroll-item-color {
- position: absolute;
- bottom: 14rpx;
- left: 50%;
- transform: translate(-50%, 0);
- width: 100rpx;
- height: 6rpx;
- background-color: rgba(5, 204, 161, 1);
- }
- }
- }
- </style>
|