Dhtmlx Event Calendar 付费版使用

<template>
  <div ref="eventCalendarRef" class="event-calendar"></div>
</template>

<script lang="ts" setup>
import { onMounted, ref } from "vue";
// @ts-ignore
import { eventCalendar } from "./lib/event-calendar.dev.js";
import "./lib/event-calendar.css";
import { eventCalendarProps } from "./event-calendar";
defineOptions({ name: "EventCalendar" });
const {
  events,
  date,
  config,
  locale,
  mode,
  calendars,
  colors,
  editorConfig,
  editorValidation,
} = defineProps(eventCalendarProps);
const eventCalendarRef = ref();
const eventCalendarInstance = ref();
const { EventCalendar } = eventCalendar;
onMounted(() => {
  eventCalendarInstance.value = new EventCalendar(eventCalendarRef.value, {
    config: config,
    events: events,
    calendars: calendars,
    date: date,
    mode: mode,
    colors: colors,
    editorConfig: editorConfig,
    editorValidation: editorValidation,
    locale: eventCalendar[locale],
  });
});

defineExpose({
  instance: eventCalendarInstance,
});
</script>

<style lang="scss" scoped>
</style>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
首先,你需要安装 `dhtmlx-gantt` 和 `@dhtmlx/trial` 依赖包。可以使用以下命令进行安装: ``` npm install dhtmlx-gantt @dhtmlx/trial ``` 接下来,你需要在 Vue3 项目引入 `dhtmlx-gantt` 和 `@dhtmlx/trial`: ```javascript import { createApp } from 'vue' import App from './App.vue' import Gantt from 'dhtmlx-gantt' import 'dhtmlx-gantt/codebase/dhtmlxgantt.css' import '@dhtmlx/trial/lib/dhtmlxgantt.css' const app = createApp(App) app.config.globalProperties.$gantt = Gantt app.mount('#app') ``` 在上述代码,我们首先引入了 `dhtmlx-gantt` 和 `@dhtmlx/trial`,然后将 Gantt 对象挂载到 Vue3 实例的全局属性,最后在 Vue3 项目的入口文件将应用程序挂载到 `#app` 元素。 现在,你可以在 Vue3 组件使用 `Gantt` 对象了。例如,在你的组件使用以下代码将 Gantt 视图渲染到页面上: ```javascript <template> <div ref="gantt"></div> </template> <script> export default { mounted() { const gantt = this.$gantt.init(this.$refs.gantt) gantt.parse({ data: [ { id: 1, text: 'Task #1', start_date: '2022-01-01', duration: 5 }, { id: 2, text: 'Task #2', start_date: '2022-01-08', duration: 3 }, ], }) }, } </script> ``` 在上述代码,我们在组件使用 `ref` 属性创建了一个 `div` 元素,并将其传递给 `Gantt.init()` 方法来初始化 Gantt 视图。然后,我们使用 `gantt.parse()` 方法将任务数据传递给 Gantt。 希望这可以帮助你开始使用 `dhtmlx-gantt` 在 Vue3 创建 Gantt 图表!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值