Blame view

src/components/tabs/pane.vue 1.67 KB
871ed4d8   梁灏   init Tabs component
1
  <template>
68335adb   梁灏   fix #5111 , close...
2
      <div :class="prefixCls" v-show="show" :style="contentStyle"><slot></slot></div>
871ed4d8   梁灏   init Tabs component
3
4
  </template>
  <script>
17f52abf   梁灏   update Tabs
5
6
      const prefixCls = 'ivu-tabs-tabpane';
  
871ed4d8   梁灏   init Tabs component
7
      export default {
17f52abf   梁灏   update Tabs
8
          name: 'TabPane',
4d8b4016   梁灏   update Tabs metho...
9
          inject: ['TabsInstance'],
17f52abf   梁灏   update Tabs
10
          props: {
30510c3d   梁灏   support Tabs
11
              name: {
17f52abf   梁灏   update Tabs
12
13
14
                  type: String
              },
              label: {
bef89707   Aresn   update tabs
15
                  type: [String, Function],
17f52abf   梁灏   update Tabs
16
17
18
19
20
21
22
23
                  default: ''
              },
              icon: {
                  type: String
              },
              disabled: {
                  type: Boolean,
                  default: false
7a737482   梁灏   fixed #206
24
25
26
27
              },
              closable: {
                  type: Boolean,
                  default: null
17f52abf   梁灏   update Tabs
28
29
              }
          },
871ed4d8   梁灏   init Tabs component
30
          data () {
17f52abf   梁灏   update Tabs
31
32
              return {
                  prefixCls: prefixCls,
30510c3d   梁灏   support Tabs
33
34
                  show: true,
                  currentName: this.name
b0893113   jingsam   :art: add eslint
35
              };
17f52abf   梁灏   update Tabs
36
          },
68335adb   梁灏   fix #5111 , close...
37
38
39
          computed: {
              contentStyle () {
                  return {
4d8b4016   梁灏   update Tabs metho...
40
                      visibility: this.TabsInstance.activeKey !== this.currentName ? 'hidden' : 'visible'
68335adb   梁灏   fix #5111 , close...
41
42
43
                  };
              }
          },
17f52abf   梁灏   update Tabs
44
45
          methods: {
              updateNav () {
4d8b4016   梁灏   update Tabs metho...
46
                  this.TabsInstance.updateNav();
17f52abf   梁灏   update Tabs
47
              }
871ed4d8   梁灏   init Tabs component
48
          },
17f52abf   梁灏   update Tabs
49
          watch: {
30510c3d   梁灏   support Tabs
50
51
52
53
              name (val) {
                  this.currentName = val;
                  this.updateNav();
              },
17f52abf   梁灏   update Tabs
54
55
56
57
58
59
60
61
62
              label () {
                  this.updateNav();
              },
              icon () {
                  this.updateNav();
              },
              disabled () {
                  this.updateNav();
              }
420ef343   梁灏   fixed #155
63
          },
30510c3d   梁灏   support Tabs
64
          mounted () {
420ef343   梁灏   fixed #155
65
              this.updateNav();
c2d74eca   梁灏   fixed #2100
66
67
68
          },
          destroyed () {
              this.updateNav();
17f52abf   梁灏   update Tabs
69
          }
b0893113   jingsam   :art: add eslint
70
71
      };
  </script>