Commit 924ce5e53e424b410d43941851a75d70dadd20ff
1 parent
e77474de
remove href prop
Showing
1 changed file
with
3 additions
and
15 deletions
Show diff stats
src/components/breadcrumb/breadcrumb-item.vue
| 1 | <template> | 1 | <template> |
| 2 | <span> | 2 | <span> |
| 3 | - <a v-if="to || href" :class="linkClasses" @click="handleClick"> | 3 | + <a v-if="to" :class="linkClasses" @click="handleClick"> |
| 4 | <slot></slot> | 4 | <slot></slot> |
| 5 | </a> | 5 | </a> |
| 6 | <span v-else :class="linkClasses"> | 6 | <span v-else :class="linkClasses"> |
| @@ -13,15 +13,13 @@ | @@ -13,15 +13,13 @@ | ||
| 13 | </span> | 13 | </span> |
| 14 | </template> | 14 | </template> |
| 15 | <script> | 15 | <script> |
| 16 | - // todo 3.0 时废弃 href | 16 | + import mixinsLink from '../../mixins/link'; |
| 17 | const prefixCls = 'ivu-breadcrumb-item'; | 17 | const prefixCls = 'ivu-breadcrumb-item'; |
| 18 | 18 | ||
| 19 | export default { | 19 | export default { |
| 20 | name: 'BreadcrumbItem', | 20 | name: 'BreadcrumbItem', |
| 21 | + mixins: [ mixinsLink ], | ||
| 21 | props: { | 22 | props: { |
| 22 | - href: { | ||
| 23 | - type: [Object, String] | ||
| 24 | - }, | ||
| 25 | to: { | 23 | to: { |
| 26 | type: [Object, String] | 24 | type: [Object, String] |
| 27 | }, | 25 | }, |
| @@ -46,16 +44,6 @@ | @@ -46,16 +44,6 @@ | ||
| 46 | }, | 44 | }, |
| 47 | mounted () { | 45 | mounted () { |
| 48 | this.showSeparator = this.$slots.separator !== undefined; | 46 | this.showSeparator = this.$slots.separator !== undefined; |
| 49 | - }, | ||
| 50 | - methods: { | ||
| 51 | - handleClick () { | ||
| 52 | - const isRoute = this.$router; | ||
| 53 | - if (isRoute) { | ||
| 54 | - this.replace ? this.$router.replace(this.to || this.href) : this.$router.push(this.to || this.href); | ||
| 55 | - } else { | ||
| 56 | - window.location.href = this.to || this.href; | ||
| 57 | - } | ||
| 58 | - } | ||
| 59 | } | 47 | } |
| 60 | }; | 48 | }; |
| 61 | </script> | 49 | </script> |