Giter VIP home page Giter VIP logo

Comments (12)

w1301625107 avatar w1301625107 commented on June 24, 2024
timelines array -- 显示标记时间,有特殊格式 [{time:'2019-01-11 18:18:18',color:'#00000'}]

这个不能满足要求吗?

from vue-gantt-chart.

jason1983 avatar jason1983 commented on June 24, 2024

我改的是源码。。。已经加了一条23:59:59了,但只是当天的。。。能不能让动态的时间轴每天都加一条

from vue-gantt-chart.

jason1983 avatar jason1983 commented on June 24, 2024

zeroTime: dayjs().endOf("day").toString(),这样能获取到当天的。如何让每天都加一条上去,烦请指教

from vue-gantt-chart.

w1301625107 avatar w1301625107 commented on June 24, 2024

你传递开始结束时间的时候,顺便用computed 计算出每天的时间线可以吗

from vue-gantt-chart.

jason1983 avatar jason1983 commented on June 24, 2024

不行,烦请明示怎么操作。
我按照currentTime写了个zerotime的组件,然后我在gantt.vue里面computed,好像没起效

from vue-gantt-chart.

w1301625107 avatar w1301625107 commented on June 24, 2024

没起效是什么情况?用devtools打印出计算出的每天的时间线看看正不正确。然后在看传递的到对应子组件的正不正确。

from vue-gantt-chart.

jason1983 avatar jason1983 commented on June 24, 2024

在gantt.vue里面写computed是么?我写了一条:
zeroTime () {
//计算出每天的时间线
const { scale, start } = this;
const zeroTime = getBeginTimeOfTimeLine(start, scale);
return zeroTime;
},
gantt里面组件这么写:

然后如何传递给对应的子组件,用props?还是用provide?

from vue-gantt-chart.

w1301625107 avatar w1301625107 commented on June 24, 2024

明显不太对吧。你这样的zeroTime 是数组吗?不应该是

const { scale, start,end } = this;
const endOfDays=[]
while(start<end){
  endOfDays.push(start.endOf('day')
  start.add(1,'day')
}
return endOfDays

大概这么个意思

from vue-gantt-chart.

jason1983 avatar jason1983 commented on June 24, 2024

嗯,好的,谢谢大神,这么加可能会很卡,我再看下吧,谢谢指导。

from vue-gantt-chart.

jason1983 avatar jason1983 commented on June 24, 2024

目前暂时只加载两周的时间线
已经通过计算得出zeroTime,并通过prop传送到zeroTime组件里,下一步是把这个数组里面的每一条数据渲染出来线,我按照currentTime组件的写法另写了一个markline组件给zeroTime专用,通过循环想让他一直执行到数组结束为止,如下:

currentTime组件的markline写法是:return this.getPositonOffset(this.timeConfig.time);

然后我另写一个markline是这么写:
for (let i = 0; i < this.timeConfig.time.length; i++) {
let position = this.getPositonOffset(this.timeConfig.time[i]);
if (position) {
return position;
}
return position;
}
为什么只渲染了一条数据,是不是还有什么地方没弄好?
这么写也没效果
return this.timeConfig.time.map((item) => {
return this.getPositonOffset(item);
});

from vue-gantt-chart.

w1301625107 avatar w1301625107 commented on June 24, 2024

markline 一次只能渲染一条是没有问题的。不应该是v-for 循环渲染多条markline吗?

from vue-gantt-chart.

jason1983 avatar jason1983 commented on June 24, 2024

解决了。。。谢谢大神指导

from vue-gantt-chart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.