Is there a way to retrieve the data components of "calendarEvents" using the "addEventListener" method?

I am currently trying to customize the "v-calendar" element within the vuetify framework in nuxtJS. My goal is to access the data elements of "calendarEvents" through the use of the "addEventListener" method. However, I am facing difficulties in achieving this. Any assistance in solving this issue would be greatly appreciated.

<template>
  <v-sheet height="300" class="pt-3">
    <v-calendar
      type="month"
      now="2019-01-08"
      value="2019-01-08"
      event-color="blue"
      :event-margin-bottom="3"
      :events="events"
    ></v-calendar>
  </v-sheet>
</template>
<script>
  export default {
    data: () => ({
      calendarEvents: [
        {
          name: 'Vacation',
          start: '2019-01-15'
        },
        {
          name: 'Meeting',
          start: '2019-01-07',
        },
        {
          name: '30th Birthday',
          start: '2019-01-03',
        },
        {
          name: 'Conference',
          start: '2019-01-21',
        }
      ],
    }),
    mounted(){
       let elements = document.querySelectorAll('.v-event.v-event-start.v-event-end.blue.white--text > div')
       elements.forEach(item => {
           item.addEventListener('mouseover', (e) => {
               console.log(e)
               this.mouseover(e)})
        })
    },
    directives: {
      maybeDoThis:{ 
        inserted: (el, binding, vnode, oldVnode) => {
        console.log(el)
        console.log(binding)
      }}
    },
    methods: {
        mouseover: (ev) => {
            console.log(ev) // ev.target.value don't work here
        }
    }
  }
</script>

Answer №1

There's no need to manipulate the DOM in this scenario, as you can simply take advantage of the calendar's built-in events. To achieve this, you can utilize the following pattern:

@mousemove:(day/time/interval)="func"
.

@mousemove:day="mouseover"

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The functionality of a basic each/while loop in jQuery using CoffeeScript is not producing the desired results

I've been experimenting with different methods to tackle this issue. Essentially, I need to update the content of multiple dropdowns in the same way. I wanted to use an each or a while loop to keep the code DRY, but my experience in coffeeScript is li ...

Attempting to minimize the repetition of code in Redux by implementing some utility functions

Is there a potential issue with the method I'm attempting in this URL: The concept involves altering only the actions file when introducing a new action. One improvement I am considering is recursively merging the status passed from the actions with ...

Updating a model within an ng-repeat directive from external sources

Within my controller, there is a repeater where each item has its own unique status: <div ng-controller="..."> <div ng-repeat"...">{{status}}</div> </div> Currently, changing the status within the repeater by using status = &apo ...

Attention: Vanishing within specified time limit

Can you help me find a technology that will display a warning message and make it disappear with a nice effect over a set amount of time? I think AJAX or JavaScript might be able to achieve this. The warning message I'm currently using is: <scrip ...

The next-routes server.js encounters an issue: TypeError - the getRequestHandler function is not defined within the routes

I encountered an issue in my server.js file. Here is the code snippet causing the problem: const { createServer } = require('http'); const next = require('next'); const routes = require('./routes'); const app = next ({ dev: ...

Tips for optimizing my Vue.js code for search engine indexing

Recently, I created a section of a website using Vue.js (CDN version instead of CLI) that displays entries based on location. However, I discovered that the data is not able to be indexed since it loads in the front end. After researching, it seems like I ...

Creating an interactive text using Javascript functions

I am attempting to create an interactive text using JavaScript. While I can achieve this by creating a new function for each element, I realize that this approach will result in an excessive number of functions. Could anyone point out what is incorrect wi ...

Ways to retrieve the value from a button when it is clicked

I am facing an issue where I have buttons that are generated dynamically depending on the number of phone numbers available in the database. For example, if there are 3 phone numbers in the database, there will be three buttons displayed. The aim is that w ...

Displaying a list by initializing a fresh Vue instance on the router-view

Currently, I am in the process of developing a single-page application using Vue to enhance my understanding of its capabilities. The primary goal of this simple application is to exhibit a collection of acronyms, allowing users to click on a specific acro ...

The dynamic ID selector is failing to execute or initialize

Currently, I am in the process of developing a jQuery function that involves dynamically adding new <tr id="select_row"> tags. Each new tag will have an incremented ID such as select_row1, select_row2, select_row3. After successfully increasing the ...

Switch the active function from click to load

I'm looking to automate a function that checks for mobile internet connection. Currently, the function is triggered by clicking something (OnClick Function), but I want it to run automatically when the app launches! How can I achieve this? This is ...

"Emphasizing the Html.ActionLink menu for improved user navigation and

Currently, I am facing an issue with my menu. I want to clear previously visited links while keeping the current one styled as a:visited in CSS. Although I have attempted to achieve this, unfortunately, the code is not functioning properly. Here is what I ...

How to delete the last item of an array in AngularJS using scope

In my Angular controller, I have an array and a method for deleting objects. function($scope, $http){ $scope.arrayOfObjects = []; $scope.remove = function(obj){ var i = $scope.arrayOfObjects.indexOf(obj); if( i > -1 ){ ...

Tips for assigning a JSON object as the resolve value and enabling autosuggestion when utilizing the promise function

Is there a way to make my promise function auto-suggest the resolved value if it's a JSON object, similar to how the axios NPM module does? Here is an example of how axios accomplishes this: axios.get("url.com") .then((res) => { Here, axios will ...

I am currently working on obtaining images that are saved by their URL within a PHP file. These images are located within a directory named "images."

My code is incomplete and not functioning as expected. $.get("museums.php",function(data,status){ var response=''; //console.log(data); var json = $.parseJSON(data); museums = json.museums; for(let m in museums) { $("#na ...

Execute the function numerous times that is associated with an asynchronous function in JavaScript

I am currently working on two functions: one is asynchronous as it fetches data from a CSV file, and the other function renders a list of cities. The CSV file contains information about shops located in various cities. My goal is to display a list of cit ...

The TypeScript error reads: "An element is implicitly assigned the 'any' type because an expression of type 'any' cannot be used to index a specific type."

[Hey there!][1] Encountering this TypeScript error message: { "Element implicitly has an 'any' type because expression of type 'any' can't be used to index type '{ 0: { image: string; title: string; text: string; }; 1: { ...

What is the method for writing the following line in CSHTML server-side code?

<script> function a(id) { var table = document.getElementById(id); .... } </script> @{ //Is there a way to rewrite the line "var table = document.getElementById(id)" here within the ser ...

Utilizing BBC gelui within Joomla 3.0 for seamless integration

I am currently using Joomla! 3.0 with the Joomlashape Helix template and I am following a tutorial. You can check out the tutorial here. The tutorial mentions that I need to download RequireJS. Can anyone confirm if RequireJS is compatible with Joomla 3 ...

Is there a way to globally access a programming class in Vue.js?

I need help with declaring a new class in Vue.js class User{ constructor(){ this.id; this.name; this.email; this.username; this.password; } } I want to instantiate it within any component like this export default { ...