| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <template>
- <div class="thirdMenu">
- <a-tabs v-model:activeKey="current" @change="menuClick">
- <a-tab-pane :key="String(index)" v-for="(item, index) in list" :tab="item[value]"></a-tab-pane>
- </a-tabs>
- <slot></slot>
- </div>
- </template>
- <script lang="ts">
- import { defineComponent, ref, PropType } from 'vue';
- interface Key {
- [propName: string]: string;
- }
- export default defineComponent({
- name: 'third-menu',
- emits: ['selectMenu'],
- props: {
- list: {
- default: [],
- type: Object as PropType<Key[]>,
- },
- value: {
- // 需要绑定的值得 key
- default: 'lable',
- type: String,
- },
- selectedKey: {
- default: '0',
- type: String,
- },
- },
- components: {},
- setup(props, context) {
- const current = ref<string>(props.selectedKey.toString());
- function menuClick(value: string) {
- const index = +value;
- const item = props.list[index];
- context.emit('selectMenu', +value, item);
- }
- return {
- current,
- menuClick,
- };
- },
- });
- </script>
- <style lang="less">
- .noBorderBottom {
- border-bottom: none;
- }
- .thirdMenu {
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: 100%;
- padding-top: 2px;
- background-color: @m-black5;
- z-index: 2;
- margin-top: auto;
- .ant-tabs {
- .flex;
- .ant-tabs-bar {
- margin-bottom: 0;
- border-bottom: 0;
- .ant-tabs-nav-container {
- margin-bottom: 0;
- .ant-tabs-nav-wrap {
- margin-bottom: 0;
- .ant-tabs-nav-scroll {
- .ant-tabs-nav {
- .ant-tabs-tab {
- min-width: 121px;
- height: 26px;
- line-height: 26px;
- text-align: center;
- color: @m-grey1;
- padding: 0 20px;
- margin: 0;
- background: @m-tabbg center center no-repeat;
- background-size: cover;
- }
- .ant-tabs-tab-active.ant-tabs-tab {
- color: @m-white0;
- background: @m-tabbg-active center center no-repeat;
- background-size: cover;
- z-index: 2;
- }
- .ant-tabs-tab + .ant-tabs-tab {
- margin-left: -14px;
- }
- .ant-tabs-ink-bar {
- width: 0px !important;
- }
- }
- }
- }
- }
- }
- }
- }
- </style>
|