Blame view

examples/routers/tabs.vue 1.43 KB
17f52abf   梁灏   update Tabs
1
  <template>
c4eb5dcf   H   tabs组件导航区添加右侧slot...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
      <Row>
          <Col :span="12">
              <Tabs type="card" closable @on-tab-remove="handleTagRemove">
                  <Tab-pane label="标签一" v-if="tab0">标签一的内容</Tab-pane>
                  <Tab-pane label="标签二" v-if="tab1">标签二的内容</Tab-pane>
                  <Tab-pane label="标签三" v-if="tab2">标签三的内容</Tab-pane>
              </Tabs>
          </Col>
          <Col :span="12">
              <Tabs type="card" closable @on-tab-remove="handleTagRemove">
                  <Tab-pane :label="tab.label" v-for="tab of tabs">{{tab.content}}</Tab-pane>
                  <Button size="small" slot="right" @click="addTab">添加</Button>
              </Tabs>
          </Col>
      </Row>
17f52abf   梁灏   update Tabs
17
  </template>
c4eb5dcf   H   tabs组件导航区添加右侧slot...
18
19
20
  
  
  <script lang="babel">
17f52abf   梁灏   update Tabs
21
      export default {
087ad37d   梁灏   update Tabs
22
23
          data () {
              return {
c4eb5dcf   H   tabs组件导航区添加右侧slot...
24
25
26
27
28
                  tabs:[
                          {label:'标签0',content:'标签内容0'},
                          {label:'标签1',content:'标签内容1'},
                          {label:'标签2',content:'标签内容2'},
                  ],
087ad37d   梁灏   update Tabs
29
30
31
32
33
34
35
36
                  tab0: true,
                  tab1: true,
                  tab2: true
              }
          },
          methods: {
              handleTagRemove (name) {
                  this['tab' + name] = false;
c4eb5dcf   H   tabs组件导航区添加右侧slot...
37
38
39
              },
              addTab(){
                  this.tabs.push({label:'标签'+this.tabs.length,content:'标签内容'+this.tabs.length});
087ad37d   梁灏   update Tabs
40
41
              }
          }
17f52abf   梁灏   update Tabs
42
      }
8778b343   梁灏   init Menu components
43
  </script>