3π
β
To use dhtmlx-scheduler
with TypeScript, make sure to import dhtmlx-scheduler
in addition to the SchedulerStatic
type:
import 'dhtmlx-scheduler'
import { SchedulerStatic } from 'dhtmlx-scheduler'
Then you could use window.scheduler
like this:
const scheduler: SchedulerStatic = (window as any).scheduler
scheduler.init(/*...*)
Example of TypeScript SFC based on docs:
<template>
<div ref="scheduler"></div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import 'dhtmlx-scheduler'
import { SchedulerStatic } from 'dhtmlx-scheduler'
export default defineComponent({
name: 'scheduler',
props: {
events: {
type: Array,
default: () => []
}
},
mounted() {
const scheduler: SchedulerStatic = (window as any).scheduler // eslint-disable-line
scheduler.skin = 'material'
scheduler.config.header = [
'day',
'week',
'month',
'date',
'prev',
'today',
'next'
]
scheduler.init(this.$refs.scheduler as HTMLElement, new Date(2020, 0, 20), 'week')
scheduler.parse(this.$props.events)
}
})
</script>
<style>
@import "~dhtmlx-scheduler/codebase/dhtmlxscheduler_material.css";
</style>
π€tony19
Source:stackexchange.com