Commit 32a174366c2000eef69bc7834e4062212a93a845

Authored by 梁灏
1 parent 924ce5e5

Breadcrumb update href with a tag

examples/routers/breadcrumb.vue
... ... @@ -7,8 +7,8 @@
7 7 <template>
8 8 <div>
9 9 <Breadcrumb separator="<b class='demo-breadcrumb-separator'>=></b>">
10   - <Breadcrumb-item to="/">Home4</Breadcrumb-item>
11   - <Breadcrumb-item :to="{name: 'user', params: { userId: 123 }}">Components</Breadcrumb-item>
  10 + <Breadcrumb-item to="/button">Home4</Breadcrumb-item>
  11 + <Breadcrumb-item :to="{name: 'icon', params: { userId: 123 }}">Components</Breadcrumb-item>
12 12 <Breadcrumb-item>Breadcrumb</Breadcrumb-item>
13 13 </Breadcrumb>
14 14 <Breadcrumb separator="">
... ...
src/components/breadcrumb/breadcrumb-item.vue
1 1 <template>
2 2 <span>
3   - <a v-if="to" :class="linkClasses" @click="handleClick">
  3 + <a v-if="to" :href="linkUrl" :class="linkClasses" @click.prevent="handleClick">
4 4 <slot></slot>
5 5 </a>
6 6 <span v-else :class="linkClasses">
... ...
src/mixins/link.js
1 1 export default {
2 2 computed: {
3 3 linkUrl () {
4   -
  4 + const type = typeof this.to;
  5 + return type === 'string' ? this.to : null;
5 6 }
6 7 },
7 8 methods: {
... ...