Commit c42734ad authored by hetech's avatar hetech Committed by island205

Timeline: fix reverse broken (#16091)

parent 8f7e7a21
<template>
<ul class="el-timeline"
:class="{
'is-reverse': reverse
}">
<slot></slot>
</ul>
</template>
<script>
export default {
name: 'ElTimeline',
......@@ -24,15 +15,19 @@
};
},
watch: {
reverse: {
handler(newVal) {
if (newVal) {
this.$slots.default = [...this.$slots.default].reverse();
}
},
immediate: true
render() {
const reverse = this.reverse;
const classes = {
'el-timeline': true,
'is-reverse': reverse
};
let slots = this.$slots.default || [];
if (reverse) {
slots = slots.reverse();
}
return (<ul class={ classes }>
{ slots }
</ul>);
}
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment