vuetifyjs / vuetify

🐉 Vue Component Framework
https://vuetifyjs.com
MIT License
39.06k stars 6.91k forks source link

[Feature Request] output event information when you click on the event (for details of the event) #19624

Open Jang-Eun-Ji opened 2 weeks ago

Jang-Eun-Ji commented 2 weeks ago

Problem to solve

If you click an event in the calendar, you can't figure out which event you clicked on, so you can't implement functions such as event details

Proposed solution

If you check the number of index events that you click on the screen and import the event data every month from the server in the order of the fastest event (if the event start time is the same, the event's creation time comes first in front of the index), you can see the properties of the event you clicked on

Jang-Eun-Ji commented 2 weeks ago

I wanted to click on an event and get the details of that event, but it was hard to retrieve the details of the clicked event, so I couldn't call the server to get the specific event details that I clicked on. Here is my solution for this: I just count the 'v-chip__content' (in month-day format) on the screen. When you fetch monthly data from the server, if you retrieve it sorted by date and time, you can know which event you are currently clicking on. This is the code to find the index of the event on the screen and print it with console.log. Just so you know, my current code is a temporary solution until Vuetify further develops the data format for the calendar.

findElementIndex(event) {
      const clickedElement = event.target.closest('.v-chip__content');
      if (!clickedElement) {
        console.log('Clicked element is not a .v-chip__content element');
        return;
      }
      const allElements = Array.from(document.querySelectorAll('.v-chip__content'));
      const elementIndex = allElements.indexOf(clickedElement);
      console.log('Clicked .v-chip__content Element Index:', elementIndex);
    }