此处用到了字符串截取的方法:split方法
先上效果图:
案列:
item:“06:00:00-06:31:49,1”,
title展示时只要第一个逗号前面的内容展示出来。即:正确展示:item:“06:00:00-06:31:49”,
方法:item.split(',')[0],
code:
主要代码如下:
<template slot-scope="{row}" slot="timeAxis">
<div class="timeBox" ref="timeBox">
<!-- 标题文字 -->
<div class="timeRange"
:title="item.split(',')[0]"
:style="{left:countLeftValue(item,row.beginTime,row.endTime,row.timeAxis).left,
width: countLeftValue(item,row.beginTime,row.endTime,row.timeAxis).width,
backgroundColor:countLeftValue(item,row.beginTime,row.endTime,row.timeAxis).bgColor}"
v-for="(item,index) in row.timeAxis" :value="item.value" :key="index">
<!-- {{item}} -->
</div>
</div>
</template>
最后为了方便大家的沟通与交流请加QQ群: 625787746
请进QQ群交流:【IT博客技术分享群①】:https://jq.qq.com/?_wv=1027&k=DceI0140