fixed #2214
This commit is contained in:
parent
6d2b7bcbc9
commit
05265beef7
2 changed files with 11 additions and 7 deletions
|
@ -7,8 +7,8 @@
|
|||
<template>
|
||||
<div>
|
||||
<Breadcrumb separator="<b class='demo-breadcrumb-separator'>=></b>">
|
||||
<Breadcrumb-item href="/">Home4</Breadcrumb-item>
|
||||
<Breadcrumb-item href="/checkbox" replace>Components</Breadcrumb-item>
|
||||
<Breadcrumb-item to="/">Home4</Breadcrumb-item>
|
||||
<Breadcrumb-item :to="{name: 'user', params: { userId: 123 }}">Components</Breadcrumb-item>
|
||||
<Breadcrumb-item>Breadcrumb</Breadcrumb-item>
|
||||
</Breadcrumb>
|
||||
<Breadcrumb separator="">
|
||||
|
@ -18,7 +18,7 @@
|
|||
<b style="color: #ff5500;">-></b>
|
||||
</template>
|
||||
</Breadcrumb-item>
|
||||
<Breadcrumb-item href="/components/breadcrumb">
|
||||
<Breadcrumb-item href="/components/page">
|
||||
<template>Breadcrumb</template>
|
||||
<template slot="separator">
|
||||
<b style="color: #ff5500;">-></b>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue