1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
| <template>
| <ul>
| <li v-for="(page, index) in pageList" :key="index" :class="page.path == activePage ? 'act' : ''">
| <span @click="onTabClick(page.path)">{{page.title}}</span>
| <a-icon type="close" @click="onClose(page.path)"/>
| </li>
| </ul>
| </template>
|
| <script>
| export default {
| name: 'tabs-header',
| props: {
| pageList: Array,
| activePage: String
| },
| methods: {
| onTabClick(key) {
| if(this.activePage !== key) {
| this.$emit('change', key)
| }
| },
| onClose(key) {
| this.$emit('close', key)
| }
| }
| }
| </script>
|
| <style lang="less" scoped>
| ul {
| display: flex;
| list-style-type: none;
| padding-left: 16px;
| margin-top: 16px;
| margin-bottom: 0px;
| li {
| padding: 5px 10px;
| background-color: rgb(250,250,250);
| margin-right: 10px;
| border-radius: 5px;
| cursor: pointer;
| span {
| font-size: 14px;
| margin-right: 10px;
| }
| }
| .act {
| background-color: #fff;
| color: rgb(24,144,255);
| }
| }
| </style>
|
|