You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何调换Vue V-Calendar的员工轴与时间轴布局?

解决方案

要实现员工轴与时间轴的位置调换,只需在你的v-calendar组件中添加orientation="horizontal"属性即可,这会将分类(员工)轴切换到顶部,时间轴切换到左侧,匹配你要的预期效果。

修改后的代码示例:

<v-calendar    
      category-show-all
      ref="calendar"
      event-overlap-mode="stack"
      v-model="filter.date"
      type="category"
      orientation="horizontal" <!-- 核心修改 -->
      :categories="category.list"
      :events="category.events"
      :event-color="getEventColor"
      :now="minimumDate"
      @change="getEvents"
      :row-height="60"
      :interval-height="20"
      @click:event="showEvent">
</v-calendar>

如果需要进一步微调布局细节,可以搭配以下属性:

  • time-width:设置左侧时间轴的宽度
  • category-width:设置顶部分类轴的单栏宽度
  • time-format/interval-format:调整时间轴的显示格式

内容的提问来源于stack exchange,提问作者Deepak Kumar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.05 10:16:23