Hi,
I'm trying to enable a custom tooltip over schedule component with vue3, typescript and composition Api, but I can't get it work successfully.
These are my components:
Planner.vue
PlannerTooltip.vue
How can I solve this?
Best regards,
Antonio
<script>
import { ScheduleComponent, ViewsDirective, ViewDirective, ResourcesDirective, ResourceDirective } from "@syncfusion/ej2-vue-schedule"; import PlannerTooltip from './PlannerTooltip.vue'; import '../../node_modules/@syncfusion/ej2-base/styles/material.css'; import '../../node_modules/@syncfusion/ej2-buttons/styles/material.css'; import '../../node_modules/@syncfusion/ej2-calendars/styles/material.css'; import '../../node_modules/@syncfusion/ej2-dropdowns/styles/material.css'; import '../../node_modules/@syncfusion/ej2-inputs/styles/material.css'; import '../../node_modules/@syncfusion/ej2-navigations/styles/material.css'; import '../../node_modules/@syncfusion/ej2-popups/styles/material.css'; import '../../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css'; import { createApp } from "vue"; const app = createApp(); // Template declaration var templateVue = app.component("tooltipTemplate", PlannerTooltip); export default { name: "App", // Declaring component and its directives components: { 'ejs-schedule': ScheduleComponent, 'e-views': ViewsDirective, 'e-view': ViewDirective, 'e-resources': ResourcesDirective, 'e-resource': ResourceDirective }, // Bound properties declaration data() { return { selectedDate: new Date(2021, 7, 12), allowMultiple: true, ownerDataSource: [ { OwnerText: 'Nancy', Id: 1, OwnerColor: '#ffaa00' }, { OwnerText: 'Steven', Id: 2, OwnerColor: '#f8a398' }, { OwnerText: 'Michael', Id: 3, OwnerColor: '#7499e1' }], eventSettings: { enableTooltip: true, tooltipTemplate: function () { return { template: templateVue }; }, dataSource: [ { Id: 1, Subject: 'Surgery - Andrew', EventType: 'Confirmed', StartTime: new Date(2021, 7, 10, 9, 0), EndTime: new Date(2021, 7, 10, 10, 0), OwnerId: 2 }, { Id: 2, Subject: 'Consulting - John', EventType: 'Confirmed', StartTime: new Date(2021, 7, 11, 10, 0), EndTime: new Date(2021, 7, 11, 11, 30), OwnerId: 3 }, { Id: 3, Subject: 'Therapy - Robert', EventType: 'Requested', StartTime: new Date(2021, 7, 12, 11, 30), EndTime: new Date(2021, 7, 12, 12, 30), OwnerId: 1 } ] }, }; } }; </script> |
<template>
<div class='tooltip-wrap'> <div class='content-area'> <div class='name'>{{data.Subject}}</div> </div> <div v-if='data.City!== null && data.City!==undefined' class='city'>{{data.City}}</div> <div class='time'>From : {{data.StartTime.toLocaleString()}} </div> <div class='time'>To : {{data.EndTime.toLocaleString()}} </div> </div> </template> <script> export default { name: "PlannerTooltip", data() { return { data: {} }; }, methods: {} }; </script> |
It works great
Thank you very much.