2
0
mirror of https://github.com/tenrok/vue-ganttastic.git synced 2026-06-25 02:00:33 +03:00

fix: forgot sort after adding bar

This commit is contained in:
yicone
2021-02-23 18:45:14 +08:00
parent 6870614b82
commit 0100d60d89
+8 -1
View File
@@ -134,10 +134,17 @@ export default {
) )
let bar = {} let bar = {}
bar[this.ganttChartProps.barStartKey] = time.format() bar[this.ganttChartProps.barStartKey] = time.format()
bar[this.ganttChartProps.barEndKey] = time.add(this.getDefaultBarLength(), this.timeUnit).format() bar[this.ganttChartProps.barEndKey] = time
.add(this.getDefaultBarLength(), this.timeUnit)
.format()
bar.ganttBarConfig = { handles: true } bar.ganttBarConfig = { handles: true }
this.bars.push(bar) this.bars.push(bar)
this.bars.sort((first, second) =>
moment(first[this.ganttChartProps.barStartKey]).diff(
second[this.ganttChartProps.barStartKey]
)
)
}, },
onMouseover() { onMouseover() {