What is the outcome of using VueUse.useMouse() if it is not made reactive?

Whenever I use VueUse.useMouse(), the results in console.log() change as I move the mouse. However, the results within <span></span> always remain 0. This is quite confusing to me, can someone please explain why this is happening? 😫😫😫

<script async="async" src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b9dcca94d4d6ddccd5dc94cad1d0d4caf98897819789">[email protected]</a>/dist/es-module-shims.min.js"></script>
<script type="importmap">
{ "imports" : {
    "vue"               : "https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7006051530435e435e44">[email protected]</a>/dist/vue.esm-browser.prod.js",
    "@vueuse/core"      : "https://cdn.jsdelivr.net/npm/@vueuse/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="482b273a2d087978667a6679">[email protected]</a>/+esm"
} }
</script>

<div id="app01">
    <!-- xy always 0 -->
    <span>mouse : {{x}} | {{y}}</span>
</div>
<script type="module">
import * as Vue from 'vue';
import * as VueUse from '@vueuse/core'
let vc01 = Vue.createApp({
    setup : function(props, {attrs, emit, slots, expose, }){
        
        let { x, y, } = VueUse.useMouse();
        
        // log will change when mouse move
        setInterval(function(){
            console.log(x.value, y.value);
        }, 1000);
        
        return { x, y, };
        
    },
});
let vi01 = vc01.mount('#app01');
</script>

Answer â„–1

It appears that the issue lies with the use of +esm. Unfortunately, jsdelivr does not support the provision of the +esm file, resulting in a failure to read the @vueuse/shared module. To resolve this issue, you can modify the code as follows. 😑😑😑

<script async="async" src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="89ecfaa4e4e6edfce5eca4fae1e0e4fac9b8a7b1a7b9">[email protected]</a>/dist/es-module-shims.min.js"></script>
<script type="importmap">
{ "imports" : {
    "vue-demi"       : "https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="592f2c3c743d3c3430196977686d776c">[email protected]</a>/lib/v3/index.min.mjs",
    "vue"            : "https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cfb9baaa8ffce1fce1fb">[email protected]</a>/dist/vue.esm-browser.prod.js",
    "@vueuse/core"   : "https://cdn.jsdelivr.net/npm/@vueuse/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3c5f534e597c0d0c120e120d">[email protected]</a>/index.min.mjs", 
    "@vueuse/shared" : "https://cdn.jsdelivr.net/npm/@vueuse/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="55263d342730311564657b677b64">[email protected]</a>/index.min.mjs"
} }
</script>

<div id="app01">
    <span>mouse : {{x}} | {{y}}</span>
</div>

<script type="module">
import * as Vue from 'vue';
import * as VueUseCore from '@vueuse/core';

let vc01 = Vue.createApp({
    setup : function(props, {attrs, emit, slots, expose, }){
        let { x, y, } = VueUseCore.useMouse();
        return { x, y, };
    },
});

let vi01 = vc01.mount('#app01');
</script>

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

Omit certain components from the JQuery ListNav plugin

I recently incorporated the Jquery plugin for record filtration. I obtained this plugin from the following link: After successfully implementing the plugin, I encountered an issue where it was counting the headings along with the alphabet filters in my co ...

What is the best way to convert the information from a <SelectInput /> component or similar components into another language?

Within my React admin v3 application, When retrieving data from the servers for my entity, I receive a unique identifier called a slug. This slug is a special key that needs to be translated on the client side. Here is an example of my <CallMeBackCre ...

Creating a fixed navigation bar that stays at the top of the page when scrolling

I am trying to create a navigation bar similar to the one seen on W3School's website. I would like the navigation bar to overlap the header when scrolling down, and for the header to appear above the nav bar when scrolling back to the top. Despite m ...

A comprehensive guide on creating translation files using grunt angular-translate from original JSON files containing translations

I have a unique angular application that requires support for multiple languages. To achieve this, I have implemented the angular translate task in the following manner. My goal is to create separate language files which can be loaded later using the useSt ...

The table row disappears but the value persists

I have designed a table where users can perform calculations. However, when a row is deleted, the values from that row appear in the row below it and subsequent rows as well. What I want is for the user to be able to completely remove a row with its values ...

Exploring Custom Routes in Vue.js

I have been attempting to configure a Vue.js route like this: { path: '/#/reset*', name: 'Confirm Reset Password', meta: { title: `Confirm password reset` }, component: ConfirmResetPassword }, I want it to match with a URL str ...

What is the method or variable called "afterShow" used for in FancyBox V4 and how does it differ from its counterpart in JQuery-FancyBox V3?

We previously utilized the V3 edition of Fancybox, incorporating our increaseImageClicks and increaseVideoClicks functions within its afterShow function: /* FANCYBOX OLD (https://web.archive.org/web/20210325170940/https://fancyapps.com/fancybox/3/docs/): * ...

Modifying shapes and figures in three-dimensional Javascript

I am currently struggling to transform a cube into a sphere in Three.js either after a specific time interval or upon an event click. I have attempted changing the geometry property from BoxGeometry to SphereGeometry with no success. Despite trying some po ...

Utilize JavaScript variables with jQuery: A simple guide

I need assistance with adding a class after selecting the checkbox. The variable values come from a database using PHP. var a = user<?php echo $i; ?>; Although this displays the correct value, I am struggling to pass it to jQuery in order to add the ...

The Correct Approach for Implementing Error Handling in a Node.js API Server

In my Node.js API server, I encountered an issue with error handling. To tackle this problem, I developed a module specifically for error handling. When in development mode, this module sends JSON objects containing errors to the API client. Here is an exa ...

What steps should I take to ensure that Vim properly formats the indentation for this JavaScript code?

Currently an Emacs user, but trying out Vim for a change. :) I'm really enjoying the quick keystrokes and the overall philosophy of Vim, however I've been running into some issues with the more advanced features. One problem I'm having is w ...

Trouble with Google Interactive Charts failing to load after UpdatePanel refresh

Desperately seeking assistance! I have spent countless hours researching this issue but have hit a dead end. My dilemma involves using the Google Interactive Charts API within an UpdatePanel to dynamically update data based on dropdown selection changes. H ...

What is the best way to manage permissions for routes pulled from the database?

When working with Vue, I often need to restrict certain pages for specific users. To achieve this, I typically define permissions in the router's meta section. For example: routes: [ { path: 'transport', name: 'trans ...

Utilizing Angular2 Observables for Time Interval Tracking

I'm working on a function that needs to be triggered every 500ms. My current approach in angular2 involves using intervals and observables. Here's the code snippet I've implemented so far: counter() { return Observable.create(observer =&g ...

Accessing CouchDB using AngularJS requires users to sign in, with the authentication cookie only being sent to the `/_

Check out my previous posts on this topic here: 1, 2 I currently have an AngularJS app with two controllers. The first one interacts with CouchDB documents, while the second handles sign-in requests to example.com/demo/_session. Upon opening the applicat ...

Continuous polling with Ajax in Rails does not trigger the display of an alert box

Trying to implement ajax polling using the RailsCast tutorial on ajax polling (#229) but encountering an issue where the alert box doesn't pop up after running the server. Here's the code in app/views/quotes/index.js.erb: alert('Hey') ...

What methods are most effective for designing a static side panel featuring a personalized tree-style list?

I am currently working on a sidebar design which is not rendering correctly, displaying a lot of flicker when expanded. I opted for b-nav instead of a traditional sidebar due to the interference it caused with my horizontal navigation bar. Here are my code ...

Pass RGBA color code from JavaScript to Laravel controller

I have an exciting project where users need to select a color value in hex format. Once I retrieve this value in JavaScript, I convert it to Rgba format. Now, my challenge is figuring out how to send this converted value to the controller for database stor ...

What is the best way to incorporate global variables within Vue JS components?

I am currently working on creating a web-app using Vue JS. I have come across the concept of Single File components(.vue files) which seems like a great way to create components. However, I am looking to avoid using any node modules. That's when I dis ...