remove href prop

This commit is contained in:
梁灏 2018-06-20 17:10:53 +08:00
parent e77474de9e
commit 924ce5e53e

View file

@ -1,6 +1,6 @@
<template> <template>
<span> <span>
<a v-if="to || href" :class="linkClasses" @click="handleClick"> <a v-if="to" :class="linkClasses" @click="handleClick">
<slot></slot> <slot></slot>
</a> </a>
<span v-else :class="linkClasses"> <span v-else :class="linkClasses">
@ -13,15 +13,13 @@
</span> </span>
</template> </template>
<script> <script>
// todo 3.0 href import mixinsLink from '../../mixins/link';
const prefixCls = 'ivu-breadcrumb-item'; const prefixCls = 'ivu-breadcrumb-item';
export default { export default {
name: 'BreadcrumbItem', name: 'BreadcrumbItem',
mixins: [ mixinsLink ],
props: { props: {
href: {
type: [Object, String]
},
to: { to: {
type: [Object, String] type: [Object, String]
}, },
@ -46,16 +44,6 @@
}, },
mounted () { mounted () {
this.showSeparator = this.$slots.separator !== undefined; this.showSeparator = this.$slots.separator !== undefined;
},
methods: {
handleClick () {
const isRoute = this.$router;
if (isRoute) {
this.replace ? this.$router.replace(this.to || this.href) : this.$router.push(this.to || this.href);
} else {
window.location.href = this.to || this.href;
}
}
} }
}; };
</script> </script>