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> <script>
export default { export default {
name: 'ElTimeline', name: 'ElTimeline',
...@@ -24,15 +15,19 @@ ...@@ -24,15 +15,19 @@
}; };
}, },
watch: { render() {
reverse: { const reverse = this.reverse;
handler(newVal) { const classes = {
if (newVal) { 'el-timeline': true,
this.$slots.default = [...this.$slots.default].reverse(); 'is-reverse': reverse
} };
}, let slots = this.$slots.default || [];
immediate: true if (reverse) {
slots = slots.reverse();
} }
return (<ul class={ classes }>
{ slots }
</ul>);
} }
}; };
</script> </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