Vue: Dragover event experiencing delayed responses from elements

One part of my webpage consists of two columns, a left column and a much larger right column. The right column contains around 1500 rows of components, each row having 5 div cells. I have set up a dragover event on the parent element that encompasses these two columns. Whenever the dragover event is triggered, an overlay div should appear and cover the entire window area as shown in the example code snippet below:

Javascript

let row = {
    props: ['item'],
    template: `<div class="row">
                   <div class="cell">{{item.value1}}</div>
                   <div class="cell">{{item.value2}}</div>
                   <div class="cell">{{item.value3}}</div>
                   <div class="cell">{{item.value4}}</div>
                   <div class="cell">{{item.value5}}</div>
               </div>
};

new Vue({
    el: '#parent',
    components: {
        'row': row
    },
    template: `<div id="parent" @dragover="showOverlay">
                   <!-- display if this.overlay == true, otherwise hide -->
                   <div class="overlay" v-show="overlay"></div>

                   <div class="left-column">Drag a file and drop</div>
                   <div class="right-column">
                       <row :rows="rows" v-for="item in rows"></row>
                   </div>
               </div>`,
    data: {
        rows: [...],
        overlay: false
    },
    methods: {
        showOverlay(e) {
            e.preventDefault();
            this.overlay = true;
        }
    }
});

While the code works fine, there seems to be some lag while scrolling through the list. Additionally, when dragging a file over the right column, it takes a few seconds for the overlay to appear compared to less than a second when dragging onto the left column.

HTML

<div id="parent"></div>

Answer №1

It is advisable to eliminate the e.preventDefault(); function as it appears to be the source of the delay.

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

Loading React.js components before data fetch is complete

My app is encountering an issue where it renders before the fetch operation is completed, resulting in incorrect rendering. Below is the code snippet: componentWillMount() { fetch('http://localhost:8081/milltime/login?users='+this.state.e ...

handling events by invoking wrapped asynchronous functions within the Meteor framework

Dealing with the issue of making a synchronous call using Meteor, we have the following scenario: var twitPost = Meteor._wrapAsync(twit.post.bind(twit)); function process(screen_name) { twitGet('users/show', {'screen_name': screen_n ...

Instructions for showing a "read more" and "read less" link when the text goes beyond a

I am pulling paragraph content from the database and displaying only 300 characters on the screen, with a "read more" option for the user to see the rest of the content. However, I am facing an issue where I also need to include a "less" option for the us ...

Building applications with Vue.js and Framework7 while incorporating the powerful Axios library

I am inexperienced with framework7 and vuejs. Can someone confirm if I am importing it correctly? Additionally, how can I make axios accessible from other pages? Here is my main.js file. I’m uncertain if the import process is accurate or if any steps ar ...

Angular2: The NgFor directive is designed to work with Iterables like Arrays for data binding

I'm currently working on a university project to develop a web application consisting of a Web API and a Frontend that interacts with the API. The specific focus of this project is a recipe website. Although I have limited experience with technologies ...

Error: 'concurrently command not recognized' even though it was installed globally

I am currently facing an issue on my macOs system. Even though I have installed concurrently globally through npm, whenever I set it as a start script in my package.json file and try running npm start, I encounter the following error. concurrently - k ...

Error in Node.js: Cannot listen on socket.io object as it does not have a 'listen' method

I am currently developing a Node application using socket.io version 0.9.13 alongside Express 3.0.6. I am encountering an issue where the app fails to run due to an error stating that socket.io does not have a method called listen(). Here is the code snipp ...

Add the variable's value to the input field

It is necessary for me to concatenate a numeric value, stored in a variable, with the input fields. For example: var number = 5; var text = $("#dropdown_id").val(); I wish to append the value of the variable 'number' to 'dropdown_id' ...

Is it possible to incorporate an existing svg from the page into another svg element?

Currently, I am facing a challenge where I am programmatically creating logos as svgs with d3. Now, I have an svg map and I want to incorporate these logos into it. I am wondering if there is a way, whether through d3 or another method, to transfer these ...

How can I use JavaScript regex to extract the first term to the left of a specific symbol?

Having a string in this format str = "Is toffee=sweet?" I need to retrieve the first term on the left side of =, which in this case is toffee. To accomplish this, I use the following code snippet: str.split("=")[0].split(" ").splice(-1,1)[0] This retu ...

Getting your JS project off the ground with NPM!

I am looking to develop a vanilla JavaScript project that utilizes npm packages, but I want to do it without using bundlers like Webpack. Here is a basic structure: index.html: <div id="app"></div> <script src="./index.js" type="module"&g ...

Leveraging route configuration's scope in HTML

As a beginner in AngularJs, I am currently exploring the creation of a single page application. However, I am encountering difficulties in converting my initial code into more professional and efficient code. During this conversion process, I have separate ...

Utilizing Vue Router to leverage specific getters from Vuex

I am currently facing an issue with accessing the authenticated user in my Vuex store within my router.js file. { path: '/admin/login', name: 'admin-login', component: AdminLogin, beforeEnter(to, from, next) { console.log(s ...

How can I customize the styling of an SVG pseudo element using Font Awesome 5?

I've implemented font awesome 5 pseudo elements to attach an :after tag to my element as shown below: &:after { content: "\f068"; font-weight:400; color:$brandRed; float:right; font-family: "Font Awesome 5 Pro"; } The c ...

Pass data from a Firebase JavaScript callback function in the Data Access Layer (DAL) to another function in the controller

I have been developing a basic chat application that enables users to send messages in a group chat and see them instantly updated. To achieve this, I opted for Firebase and spent time familiarizing myself with its web API. However, I encountered difficult ...

The CORS policy has prevented access to 'https://localhost:7144/api/employees' from 'http://localhost:3000'

I encountered an error while attempting to retrieve data from a web API to exhibit in a React JS application. The console displayed this image of the error Below is a snippet from my program.cs file: (Code snippet from program.cs goes here) Additionally ...

Is there a different method similar to Textfield onChange that works like the HTML onChange attribute?

In my current setup, I have a Textfield component nested within other components where I pass a function pointer down to it as a prop. The challenge I'm facing is that the function responsible for passing the contents of the Textfield back up to the r ...

What is the process for transferring items using ref ObjectId's?

https://i.sstatic.net/pi6js.pngI'm currently in the process of developing a small personal betting website. I have successfully created Arrays of ObjectId's within each collection that reference one another. However, I am facing challenges when i ...

To ensure the smooth functioning of a React application running on a Docker container in Ubuntu 16.04, it is

I'm currently in the process of setting up a docker container for running a react app that sends a fetch request to another docker container containing a node server. The deployment is on Ubuntu 16.04, however, after building and deploying the contain ...

"Troubleshooting the inconsistency of GraphQL resolver context functionality between Playground and the client in the official NextJS starter

Currently, I am making adjustments to my NextJS/Apollo application to enable SSG with GraphQL API routes. I have referenced this official NextJS starter example as a foundation for configuring the client. An issue arose in my application which led me to g ...