<g
id="timeScale"
transform="translate(0,28)"
fill="none"
font-size="10"
font-family="sans-serif"
text-anchor="middle"
>
<path class="domain" stroke="currentColor" d="M10.5,0.5H1890.5"></path>
<g
:class="{ minor: index % 12 == 0 }"
opacity="1"
:transform="`translate(${(1880 / 144) * index + 10},0)`"
v-for="(item, index) in timeList"
:key="index"
>
<line stroke="currentColor" :y2="index % 12 == 0 ? 9 : 6"></line>
<text fill="#000" y="14" dy="0.71em" v-if="index % 12 == 0">
{{ item }}
</text>
</g>
</g>
getTime() {
let endDate = new Date();
let splitTime = 5 * 60 * 1000;
let count = 144;
//转为时间戳
let endTime = endDate.getTime();
let mod = endTime % splitTime;
if (mod > 0) {
endTime = endTime - mod;
}
while (count-- > 0) {
let d = new Date();
d.setTime(endTime - count * splitTime);
this.timeList.push(moment(d).format("HH:mm"));
}
},
|