Blame view

examples/routers/tabs.vue 1.42 KB
17f52abf   梁灏   update Tabs
1
  <template>
c4eb5dcf   H   tabs组件导航区添加右侧slot...
2
3
4
5
6
7
8
9
10
11
      <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">
8e4f708f   梁灏   update Tabs
12
13
                  <Tab-pane :label="tab.label" v-for="tab of tabs" :key="tab">{{tab.content}}</Tab-pane>
                  <Button size="small" slot="extra" @click="addTab">添加</Button>
c4eb5dcf   H   tabs组件导航区添加右侧slot...
14
15
16
              </Tabs>
          </Col>
      </Row>
17f52abf   梁灏   update Tabs
17
  </template>
c4eb5dcf   H   tabs组件导航区添加右侧slot...
18
19
  
  
3e3ac4f5   梁灏   release 2.0.0-rc.7
20
  <script>
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>