Blame view

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