当前位置: 首页 > news >正文

vue-ganttastic在vue3中使用示例

下载

npm install @infectoone/vue-ganttastic

以全局使用为例

//main.js

import { createApp } from 'vue'

import './style.css'

import App from './App.vue'

import ganttastic from '@infectoone/vue-ganttastic'

const app= createApp(App)

app.use(ganttastic)

app.mount('#app')
<template>

    <div class="gantt-div">

      <g-gantt-chart

      chart-start="2021-07-12 00:00"

      chart-end="2021-07-14 00:00"

      precision="day"

      bar-start="myBeginDate"

      bar-end="myEndDate"

    >

      <g-gantt-row :bars="row1BarList" />

      <g-gantt-row :bars="row2BarList" />

      <g-gantt-row :bars="row3BarList" />

    </g-gantt-chart>

    </div>

  </template>

  <script setup>

  import dayjs from 'dayjs';

  import 'dayjs/locale/zh-cn';





  // 全局使用中文

  dayjs.locale('zh-cn');

  import { ref } from "vue"

    const row1BarList = ref([

      {

        myBeginDate: "2021-07-12 00:00",

        myEndDate: "2021-07-13 12:00",

        ganttBarConfig: {

          // each bar must have a nested ganttBarConfig object ...

          id: "unique-id-1", // ... and a unique "id" property

          label: "Lorem ipsum dolorn"

        }

      }

    ])

    const row2BarList = ref([

      {

        myBeginDate: "2021-07-13 00:00",

        myEndDate: "2021-07-13 23:59",

        ganttBarConfig: {

          id: "another-unique-id-2",

          hasHandles: true,

          label: "Hey, look at me",

          style: {

            // arbitrary CSS styling for your bar

            background: "#e09b69",

            borderRadius: "20px",

            color: "black"

          },

          class: "foo" // you can also add CSS classes to your bars!

        }

      }

    ])

    const row3BarList = ref([

      {

        myBeginDate: "2021-07-13 00:00",

        myEndDate: "2021-07-13 00:01",

        ganttBarConfig: {

          id: "another-unique-id-3",

          hasHandles: true,

          label: "Hey, look at me",

          style: {

            // arbitrary CSS styling for your bar

            background: "#e09b69",

            borderRadius: "20px",

            color: "black"

          },

          class: "foo" // you can also add CSS classes to your bars!

        }

      }

    ])

  </script>





<style scoped>

.gantt-div{

  width: 100%;

  height: 600px;

  overflow: auto;

}

</style>

http://www.dtcms.com/a/124008.html

相关文章:

  • CISA关键措施要求解析:提升组织网络安全的实用指南
  • 近两年年化是177.6%,wxpython+backtrader+quantstats的智能投研平台(系统源码+策略下载)
  • LangChain4j(1):初步认识Java 集成 LLM 的技术架构
  • Dart逆向之函数调用
  • AI | 字节跳动 AI 中文IDE编辑器 Trae 初体验
  • java线程安全-单例模式-线程通信
  • Python刷题笔记
  • Laravel 实现 队列 发送邮件功能
  • IP证书的作用与应用:保障数字身份与通信安全
  • Docker MySQL的主从同步 数据备份 数据同步 配置文件
  • C++学习之ORACLE①
  • 基于flask+vue框架的助贫公益募捐管理系统1i6pi(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。
  • BUUCTF-web刷题篇(18)
  • Python设计模式-单例模式
  • 【华为战报】2025年3月 考试战报!
  • 消息队列(IPC技术)
  • 需求获取全攻略
  • PostGIS 常用处理空间函数
  • 文章记单词 | 第26篇(六级)
  • MySQL行列转换
  • 数据泄露与防范
  • C++进阶——C++11_右值引用和移动语义_可变参数模板_类的新功能
  • window部署虚拟机VirtualBox来部署flink
  • 网络机顶盒怎么连接WiFi-机顶盒连接wifi攻略,轻松畅享网络视听
  • 我为女儿开发了一个游戏网站
  • gerrit配置及使用git-lfs
  • c++11新内容补充
  • c++类和对象——this指针
  • Vue Router(2)
  • Spring AI开发MCP Server和MCP Client