Blame view

examples/routers/tabs.vue 1.75 KB
753720d9   梁灏   Tabs add prop bef...
1
  <template>
4d8b4016   梁灏   update Tabs metho...
2
3
4
5
6
7
      <Tabs type="card" :animated="true" closable @on-tab-remove="handleTabRemove" :beforeRemove="handleBeforeRemove">
          <Wrapper>
              <TabPane label="标签一" v-if="tab0">标签一的内容</TabPane>
              <TabPane label="标签二" v-if="tab1">标签二的内容</TabPane>
              <TabPane label="标签三" v-if="tab2">标签三的内容</TabPane>
          </Wrapper>
67c9b1c8   梁灏   fixed #591
8
      </Tabs>
4d8b4016   梁灏   update Tabs metho...
9
10
11
12
13
14
  
      <!--<Tabs type="card" :animated="true" closable @on-tab-remove="handleTabRemove" :beforeRemove="handleBeforeRemove">-->
          <!--<TabPane label="标签一" v-if="tab0">标签一的内容</TabPane>-->
          <!--<TabPane label="标签二" v-if="tab1">标签二的内容</TabPane>-->
          <!--<TabPane label="标签三" v-if="tab2">标签三的内容</TabPane>-->
      <!--</Tabs>-->
17f52abf   梁灏   update Tabs
15
  </template>
3e3ac4f5   梁灏   release 2.0.0-rc.7
16
  <script>
4d8b4016   梁灏   update Tabs metho...
17
      import Wrapper from '../components/wrapper.vue';
17f52abf   梁灏   update Tabs
18
      export default {
4d8b4016   梁灏   update Tabs metho...
19
          components: { Wrapper },
087ad37d   梁灏   update Tabs
20
21
          data () {
              return {
bdfab3b9   梁灏   fixed #1842
22
23
24
25
26
27
28
29
                  tab0: true,
                  tab1: true,
                  tab2: true
              }
          },
          methods: {
              handleTabRemove (name) {
                  this['tab' + name] = false;
38ab7442   Sergio Crisostomo   Correct logic for...
30
              },
753720d9   梁灏   Tabs add prop bef...
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
              handleBeforeRemove (index) {
                  console.log(index);
  
                  return new Promise((resolve, reject) => {
                      this.$Modal.confirm({
                          title: 'Title',
                          content: '<p>Content of dialog</p><p>Content of dialog</p>',
                          onOk: () => {
                              resolve();
                          },
                          onCancel: () => {
                              reject();
                          }
                      });
                  });
be3fbd24   marxy   Tabs add scroll
46
47
48
              }
          }
      }
8778b343   梁灏   init Menu components
49
  </script>