update
This commit is contained in:
parent
5fe393db5c
commit
e77474de9e
2 changed files with 21 additions and 12 deletions
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div :class="classes" tabindex="0">
|
<div :class="classes" tabindex="0">
|
||||||
<a v-if="to" :href="to" class="ivu-cell-link" @click.prevent="handleClick">
|
<a v-if="to" :href="linkUrl" class="ivu-cell-link" @click.prevent="handleClick">
|
||||||
<CellItem :title="title" :label="label" :extra="extra">
|
<CellItem :title="title" :label="label" :extra="extra">
|
||||||
<slot name="icon" slot="icon"></slot>
|
<slot name="icon" slot="icon"></slot>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
|
@ -24,11 +24,13 @@
|
||||||
<script>
|
<script>
|
||||||
import CellItem from './cell-item.vue';
|
import CellItem from './cell-item.vue';
|
||||||
import Icon from '../icon/icon.vue';
|
import Icon from '../icon/icon.vue';
|
||||||
|
import mixinsLink from '../../mixins/link';
|
||||||
|
|
||||||
const prefixCls = 'ivu-cell';
|
const prefixCls = 'ivu-cell';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Cell',
|
name: 'Cell',
|
||||||
|
mixins: [ mixinsLink ],
|
||||||
components: { CellItem, Icon },
|
components: { CellItem, Icon },
|
||||||
props: {
|
props: {
|
||||||
name: {
|
name: {
|
||||||
|
@ -77,17 +79,7 @@
|
||||||
[`${prefixCls}-with-link`]: this.to
|
[`${prefixCls}-with-link`]: this.to
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
|
||||||
handleClick () {
|
|
||||||
const isRoute = this.$router;
|
|
||||||
if (isRoute) {
|
|
||||||
this.replace ? this.$router.replace(this.to) : this.$router.push(this.to);
|
|
||||||
} else {
|
|
||||||
window.location.href = this.to;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
17
src/mixins/link.js
Normal file
17
src/mixins/link.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
export default {
|
||||||
|
computed: {
|
||||||
|
linkUrl () {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleClick () {
|
||||||
|
const isRoute = this.$router;
|
||||||
|
if (isRoute) {
|
||||||
|
this.replace ? this.$router.replace(this.to) : this.$router.push(this.to);
|
||||||
|
} else {
|
||||||
|
window.location.href = this.to;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue