Blame view

src/components/cell/cell.vue 2.36 KB
59a3b893   梁灏   add Cell componen...
1
  <template>
5fe393db   梁灏   update
2
      <div :class="classes" tabindex="0">
e77474de   梁灏   update
3
          <a v-if="to" :href="linkUrl" class="ivu-cell-link" @click.prevent="handleClick">
da76a284   梁灏   update Cell
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
              <CellItem :title="title" :label="label" :extra="extra">
                  <slot name="icon" slot="icon"></slot>
                  <slot></slot>
                  <slot name="extra" slot="extra"></slot>
              </CellItem>
          </a>
          <div class="ivu-cell-link" v-else>
              <CellItem :title="title" :label="label" :extra="extra">
                  <slot name="icon" slot="icon"></slot>
                  <slot></slot>
                  <slot name="extra" slot="extra"></slot>
              </CellItem>
          </div>
          <div class="ivu-cell-arrow" v-if="to">
              <slot name="arrow">
                  <Icon type="ios-arrow-right"></Icon>
              </slot>
          </div>
      </div>
59a3b893   梁灏   add Cell componen...
23
24
  </template>
  <script>
da76a284   梁灏   update Cell
25
26
      import CellItem from './cell-item.vue';
      import Icon from '../icon/icon.vue';
e77474de   梁灏   update
27
      import mixinsLink from '../../mixins/link';
da76a284   梁灏   update Cell
28
29
30
  
      const prefixCls = 'ivu-cell';
  
59a3b893   梁灏   add Cell componen...
31
      export default {
da76a284   梁灏   update Cell
32
          name: 'Cell',
e77474de   梁灏   update
33
          mixins: [ mixinsLink ],
da76a284   梁灏   update Cell
34
          components: { CellItem, Icon },
59a3b893   梁灏   add Cell componen...
35
          props: {
da76a284   梁灏   update Cell
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
              name: {
                  type: [String, Number]
              },
              title: {
                  type: String,
                  default: ''
              },
              label: {
                  type: String,
                  default: ''
              },
              extra: {
                  type: String,
                  default: ''
              },
              disabled: {
                  type: Boolean,
                  default: false
              },
              selected: {
                  type: Boolean,
                  default: false
              },
              to: {
                  type: [Object, String]
              },
              replace: {
                  type: Boolean,
                  default: false
              }
59a3b893   梁灏   add Cell componen...
66
          },
da76a284   梁灏   update Cell
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
          data () {
              return {
                  prefixCls: prefixCls
              }
          },
          computed: {
              classes () {
                  return [
                      `${prefixCls}`,
                      {
                          [`${prefixCls}-disabled`]: this.disabled,
                          [`${prefixCls}-selected`]: this.selected,
                          [`${prefixCls}-with-link`]: this.to
                      }
                  ];
e77474de   梁灏   update
82
              },
da76a284   梁灏   update Cell
83
          },
59a3b893   梁灏   add Cell componen...
84
85
      }
  </script>