iview/src/components/breadcrumb/breadcrumb.vue

44 lines
932 B
Vue
Raw Normal View History

2016-09-09 14:29:19 +08:00
<template>
<div :class="classes">
<slot></slot>
</div>
</template>
<script>
const prefixCls = 'ivu-breadcrumb';
export default {
name: 'Breadcrumb',
2016-09-09 14:29:19 +08:00
props: {
separator: {
type: String,
default: '/'
}
},
computed: {
classes () {
return `${prefixCls}`;
}
},
2017-03-03 21:05:30 +08:00
mounted () {
2016-09-09 14:29:19 +08:00
this.updateChildren();
},
updated () {
2017-04-20 09:46:11 +08:00
this.$nextTick(() => {
this.updateChildren();
});
},
2016-09-09 14:29:19 +08:00
methods: {
updateChildren () {
this.$children.forEach((child) => {
child.separator = this.separator;
});
}
},
watch: {
separator () {
this.updateChildren();
}
}
2016-12-25 22:49:42 +08:00
};
</script>