当前位置: 首页 > 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>

相关文章:

  • 个人网站可以做论坛万能搜索
  • b2b网站建设公司b站新人视频怎么推广
  • 专业定制网站建设十大免费网站推广平台
  • 如何在网上推广app江北seo页面优化公司
  • 做个外贸网站大概多少钱2021年10月新闻摘抄
  • wap网站的开发北京seo网站推广
  • 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行列转换