2018-06-20 15:17:54 +08:00
|
|
|
<template>
|
2018-06-20 17:04:08 +08:00
|
|
|
<div :class="classes" tabindex="0">
|
2018-06-20 17:09:11 +08:00
|
|
|
<a v-if="to" :href="linkUrl" class="ivu-cell-link" @click.prevent="handleClick">
|
2018-06-20 16:56:54 +08:00
|
|
|
<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>
|
2018-06-20 15:17:54 +08:00
|
|
|
</template>
|
|
|
|
<script>
|
2018-06-20 16:56:54 +08:00
|
|
|
import CellItem from './cell-item.vue';
|
|
|
|
import Icon from '../icon/icon.vue';
|
2018-06-20 17:09:11 +08:00
|
|
|
import mixinsLink from '../../mixins/link';
|
2018-06-20 16:56:54 +08:00
|
|
|
|
|
|
|
const prefixCls = 'ivu-cell';
|
|
|
|
|
2018-06-20 15:17:54 +08:00
|
|
|
export default {
|
2018-06-20 16:56:54 +08:00
|
|
|
name: 'Cell',
|
2018-06-20 17:09:11 +08:00
|
|
|
mixins: [ mixinsLink ],
|
2018-06-20 16:56:54 +08:00
|
|
|
components: { CellItem, Icon },
|
2018-06-20 15:17:54 +08:00
|
|
|
props: {
|
2018-06-20 16:56:54 +08:00
|
|
|
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
|
|
|
|
}
|
2018-06-20 15:17:54 +08:00
|
|
|
},
|
2018-06-20 16:56:54 +08:00
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
prefixCls: prefixCls
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
classes () {
|
|
|
|
return [
|
|
|
|
`${prefixCls}`,
|
|
|
|
{
|
|
|
|
[`${prefixCls}-disabled`]: this.disabled,
|
|
|
|
[`${prefixCls}-selected`]: this.selected,
|
|
|
|
[`${prefixCls}-with-link`]: this.to
|
|
|
|
}
|
|
|
|
];
|
2018-06-20 17:09:11 +08:00
|
|
|
},
|
2018-06-20 16:56:54 +08:00
|
|
|
},
|
2018-06-20 15:17:54 +08:00
|
|
|
}
|
|
|
|
</script>
|