2018-06-20 15:17:54 +08:00
|
|
|
<template>
|
2018-06-20 18:07:28 +08:00
|
|
|
<div :class="classes">
|
2018-07-02 09:12:43 +08:00
|
|
|
<a
|
|
|
|
v-if="to"
|
|
|
|
:href="linkUrl"
|
|
|
|
:target="target"
|
|
|
|
class="ivu-cell-link"
|
|
|
|
@click.exact="handleClickItem($event, false)"
|
|
|
|
@click.ctrl="handleClickItem($event, true)"
|
|
|
|
@click.meta="handleClickItem($event, true)">
|
2018-06-20 16:56:54 +08:00
|
|
|
<CellItem :title="title" :label="label" :extra="extra">
|
|
|
|
<slot name="icon" slot="icon"></slot>
|
2018-06-20 18:07:28 +08:00
|
|
|
<slot slot="default"></slot>
|
2018-06-20 16:56:54 +08:00
|
|
|
<slot name="extra" slot="extra"></slot>
|
2018-06-20 18:07:28 +08:00
|
|
|
<slot name="label" slot="label"></slot>
|
2018-06-20 16:56:54 +08:00
|
|
|
</CellItem>
|
|
|
|
</a>
|
2018-06-20 18:23:27 +08:00
|
|
|
<div class="ivu-cell-link" v-else @click="handleClickItem">
|
2018-06-20 16:56:54 +08:00
|
|
|
<CellItem :title="title" :label="label" :extra="extra">
|
|
|
|
<slot name="icon" slot="icon"></slot>
|
2018-06-20 18:07:28 +08:00
|
|
|
<slot slot="default"></slot>
|
2018-06-20 16:56:54 +08:00
|
|
|
<slot name="extra" slot="extra"></slot>
|
2018-06-20 18:07:28 +08:00
|
|
|
<slot name="label" slot="label"></slot>
|
2018-06-20 16:56:54 +08:00
|
|
|
</CellItem>
|
|
|
|
</div>
|
|
|
|
<div class="ivu-cell-arrow" v-if="to">
|
|
|
|
<slot name="arrow">
|
2018-06-28 09:31:55 +08:00
|
|
|
<Icon type="ios-arrow-forward"></Icon>
|
2018-06-20 16:56:54 +08:00
|
|
|
</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 18:23:27 +08:00
|
|
|
inject: ['cellGroup'],
|
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
|
|
|
|
}
|
2018-06-20 15:17:54 +08:00
|
|
|
},
|
2018-06-20 16:56:54 +08:00
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
prefixCls: prefixCls
|
2018-06-21 09:15:00 +08:00
|
|
|
};
|
2018-06-20 16:56:54 +08:00
|
|
|
},
|
|
|
|
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 18:23:27 +08:00
|
|
|
methods: {
|
2018-07-02 09:12:43 +08:00
|
|
|
handleClickItem (event, new_window) {
|
2018-06-20 18:23:27 +08:00
|
|
|
this.cellGroup.handleClick(this.name);
|
2018-06-29 18:16:18 +08:00
|
|
|
|
2018-07-02 09:12:43 +08:00
|
|
|
this.handleCheckClick(event, new_window);
|
2018-06-20 18:23:27 +08:00
|
|
|
}
|
|
|
|
}
|
2018-06-21 09:15:00 +08:00
|
|
|
};
|
2018-06-20 15:17:54 +08:00
|
|
|
</script>
|