在vue中使用甘特图(gantt-elastic)做进度跟踪
公司要使用甘特图插件来跟踪任务的进度 ,在使用这个插件的过程中踩了太多的坑了,很多配置都没有文档的 连英文文档都没有,然后就看了源码研究了下具体的配置,具体的配置我都在下面的文章中截图有备注了。如果说有什么问题给我留言 我这边会在看到的第一时间回复。
一、首先要安装gantt-elastic这个插件
在npm官网上下载 https://www.npmjs.com/package/gantt-elastic
npm install --save gantt-elastic
npm install --save gantt-elastic-header
gantt-elastic-header 这个可以按照需求安装
二、安装之后 在代码中使用
1.要 import GanttElastic from “gantt-elastic”;
import dayjs from “dayjs”;
import GanttHeader from “gantt-elastic-header”;//这个根据需求引入
2、设置tasks
4、options设置
5、方法的调用
三、具体的代码
<template>
<div >
<gantt-elastic
v-show="showGantt"
:options="options"
:tasks="tasks"
@tasks-changed="tasksUpdates"
@options-changed="optionsUpdate"
@dynamic-style-changed="styleUpdate"
>
</gantt-elastic>
<!-- -->
</div>
</template>
<style>
</style>
<script>
import GanttElastic from "gantt-elastic";
import dayjs from "dayjs";
// import GanttHeader from "gantt-elastic-header";
//tasks是数据 真实的项目需要接口赋值数据
let that
let options = {
taskMapping: {
progress: "percent"
},
maxRows: 10,
maxHeight: 500,
// title: {
// label: "Your project title as html (link or wh