123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <template>
- <div class="simple-step">
- <div
- class="simple-step__item"
- v-for="(item, index) in list"
- :key="index"
- :class="{ active: item.id === active }"
- >
- <span v-text="item[label]"></span>
- <span class="simple-step__line"></span>
- </div>
- </div>
- </template>
- <script>
- export default {
- name: 'simple-step',
- props: {
- list: {
- type: Array,
- default: [],
- },
- label: {
- type: String,
- default: 'label',
- },
- active: {
- type: Number,
- default: 0,
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- // pc端
- @media screen and (min-width: 768px) {
- .simple-step {
- display: flex;
- justify-content: space-evenly;
- align-items: center;
- padding: 24px 0;
- .simple-step__item {
- font-size: 24px;
- color: #282828;
- position: relative;
- padding-bottom: 4px;
- cursor: pointer;
- &.active {
- .simple-step__line {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 3px;
- @include themify($themes) {
- background-color: themed('color');
- }
- }
- }
- }
- }
- }
- // 移动端
- @media screen and (max-width: 768px) {
- .simple-step {
- display: flex;
- justify-content: space-evenly;
- align-items: center;
- padding: 8vw 0 6vw;
- .simple-step__item {
- font-size: 4.2vw;
- color: #999;
- position: relative;
- padding-bottom: 1.2vw;
- cursor: pointer;
- &.active {
- color: #282828;
- .simple-step__line {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 0.5vw;
- @include themify($themes) {
- background-color: themed('color');
- }
- }
- }
- }
- }
- }
- </style>
|