This commit is contained in:
梁灏 2017-11-07 17:28:20 +08:00
parent 6d2b7bcbc9
commit 05265beef7
2 changed files with 11 additions and 7 deletions

View file

@ -1,6 +1,6 @@
<template>
<span>
<a v-if="href" :class="linkClasses" @click="handleClick">
<a v-if="to || href" :class="linkClasses" @click="handleClick">
<slot></slot>
</a>
<span v-else :class="linkClasses">
@ -13,13 +13,17 @@
</span>
</template>
<script>
// todo 3.0 href
const prefixCls = 'ivu-breadcrumb-item';
export default {
name: 'BreadcrumbItem',
props: {
href: {
type: String
type: [Object, String]
},
to: {
type: [Object, String]
},
replace: {
type: Boolean,
@ -47,9 +51,9 @@
handleClick () {
const isRoute = this.$router;
if (isRoute) {
this.replace ? this.$router.replace(this.href) : this.$router.push(this.href);
this.replace ? this.$router.replace(this.to || this.href) : this.$router.push(this.to || this.href);
} else {
window.location.href = this.href;
window.location.href = this.to || this.href;
}
}
}