The Vue component is only functioning partially and is not visible in the Vue inspector

I have a straightforward Vue component that is causing me some trouble.

<template>
  <div class="field has-addons">
      <div class="control is-expanded">
          <div class="select is-fullwidth">
              <select v-model="selected" @change="onChange($event)">
                  <option disabled value="">Select a list for Sync</option>
                  <option v-for="option in selectOptions" :value="option.id">{{option.name}}</option>
              </select>
          </div>
      </div>
      <div class="control">
          <a :href="syncUrl">
              <div class="button is-success">Sync</div>
          </a>
      </div>
  </div>
</template>
<style scoped>

</style>

<script>

  export default {
    props: {
      lists: String,
      training_id: String
    },

    mounted: function() {
      console.log('mounted');
    },

    computed: {
      syncUrl: function () {
        return "/admin/trainings/" + this.training_id + "/sync_list_to_training/" + this.selected
      }
    },

    data: function(){
      return {
        selectedList: '',
        selectOptions: '',
        selected: ''
      }
    },
    beforeMount() {
      this.selectOptions = JSON.parse(this.lists)
      this.inputName = this.name
    },

    methods: {
      onChange(event) {
            console.log(event.target.value)
        }
    }
  }
</script>

Although the component appears to be working fine and I am able to display the select with options and values, it does not show up in the Vue Inspector tool. Additionally, the select functionality does not work as expected. Even after making changes to simplify the component, like in the "Vue Example" provided below:

<template>
  <div class="field has-addons">
      <select v-model="selected">
        <option v-for="option in options" v-bind:value="option.value">
          {{ option.text }}
        </option>
      </select>
      <span>Selected: {{ selected }}</span>
  </div>
</template>
<style scoped>

</style>

<script>
export default {
  data: function(){
    return {
      selected: 'A',
      options: [
        { text: 'One', value: 'A' },
        { text: 'Two', value: 'B' },
        { text: 'Three', value: 'C' }
      ]
    }
  }
}
</script>

Even with these modifications, the component remains problematic and is still not visible in the inspector tool. The code snippet below shows how I tried to invoke the components using Vue and Turbolinks:

import Vue from 'vue/dist/vue.esm'
import TurbolinksAdapter from 'vue-turbolinks';
Vue.use(TurbolinksAdapter)

import ActiveCampaign from '../../../application/components/active_campaign/ActiveCampaign.vue'

document.addEventListener('turbolinks:load', () => {
  const vueApp = new Vue({
    el: '#app-container',
    components: {
      'active_campaign': ActiveCampaign,
    },
  })
})

There are no errors in the console, only a message stating "Detected Vue v2.6.10" from vue-devtools.

Answer №1

UPDATE:

Would you be willing to give this a shot?

Here's another trick: just wait for the next tick.

<input type="checkbox" v-model="myModel" @change="myFunction()">

...

myFunction: function() {
    var context = this;
    Vue.nextTick(function () {
        alert(context.myModel);
    }
}

You can find more information about this technique here: https://github.com/vuejs/vue/issues/293#issuecomment-265716984

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 configuration of the Braintree API client is incorrect: the clientApiUrl found in the clientToken is not valid

Error Found: Braintree API Client Misconfiguration - The clientApiUrl provided in the clientToken is invalid. Upon checking my browser log, I noticed this error. I am using a Node backend with an Angular front end and integrating Braintree javascript SDK ...

Jade not binding correctly with Angular.ErrorMessage: Angular bindings are

Struggling with simple binding in Angular and Jade. I've tried moving JavaScript references to the end of the document based on advice from previous answers, but still no luck. Any ideas on what might be wrong? File: angular.jade extends layout blo ...

It appears that the JS function is not being triggered

I am facing an issue with my JavaScript code where a ball is not showing up even though it should. I have an array with only one element, and when that element matches with "F2", the ball is supposed to appear. I suspect there might be a problem with my us ...

What is the process for transferring multiple files using a read stream in Node.js?

Suppose I have a folder containing two files, index.html and style.css, and I would like to send both of them. How can I achieve this with Node.js? Router.get('/', function(req, res) { var indexStream = fs.createWriteStream('path to index ...

Make sure to wait until the fetch function is finished before triggering another action

When I run console.log(this.detaliiMP), it currently returns an empty array. My goal is to wait for the getData() function to retrieve the data and populate the detaliiMP array before logging it to the console. Check out the demo here const app = Vue.c ...

What is the best way to send data from client-side JavaScript to node.js using XMLHttpRequest?

I have some HTML input fields in my index.html file. <input type="text" id="handle" > <input type="text" id="message" > <button id="send">send</button> After filling in the information and clicking "send", I want to pass this data ...

Is there a way to determine the color of an element when it is in a hover state?

I recently started using the Chosen plugin and noticed that the color for the :hover on the <li> elements is a bright blue. I want to change it to a bold red color instead. https://i.stack.imgur.com/mcdHY.png After inspecting it with the Chrome too ...

React Native reminder: Unable to update React state on a component that is unmounted

I am seeking clarity on how to resolve the issue in useEffect that is mentioned. Below is the data for "dataSource": [{"isSelect":false, "selectedClass":null, "zoneId":1026, "zoneName":"tomato"}, ...

Turn off a feature

I'm having trouble disabling a tooltip that is being utilized from this specific website. The code for setting and calling the tooltip looks like this: this.tooltip = function(){....} $(document).ready(function(){ tooltip(); }); I've attempte ...

How to add sass-loader to a Vue 3 project

I attempted to integrate a sass/scss loader into my project created with vue CLI. After running the following script: $ npm install -D sass-loader@^10 sass I encountered the error below: npm ERR! notsup Unsupported platform for <a href="/cdn-cgi/l/email ...

Measuring the number of distinct words within a given set of strings

Describing my attempt to create a function that processes string arrays by adding unique words to a word array, and incrementing the count of existing words in the count array: var words = []; var counts = []; calculate([a, b]); calculate([a, c]); funct ...

I encountered an error while attempting to import a file into Firebase Storage

I've been struggling to upload files from Firebase Storage and encountering errors despite reading the documentation and various blogs on the topic. I'm looking for the most effective approach to resolve this issue. import { storage } from ' ...

Preventing Event Propagation in JQuery Across Different Web Browsers

My GUI controls have a complex nested structure, and I need to prevent events from propagating up the DOM tree when they are clicked or changed. This functionality must be consistent across all browsers. Currently, I am using some cumbersome JavaScript co ...

Guide to automatically filling in a form's fields with information from a database by clicking on a link

Currently, I have a form in HTML that is designed to gather user/member information. This form connects to a database with multiple columns, with two key ones being "user_email" and "invoice_id". Upon the page loading, the input for "user_email" remains hi ...

What could be causing my date variable to reset unexpectedly within my map function?

Currently, I'm utilizing a tutorial to create a custom JavaScript calendar and integrating it into a React project You can find the functional JavaScript version in this jsfiddle import { useState, useRef, useMemo } from 'react' import type ...

What is the best way to compare an attribute value with a JSON value in JavaScript?

I have a JSON string that looks like this: { "DocID": "NA2", "DocType": "Phase1.1 - Visa Documents (This section is applicable for HK work location only)", "DocSubType": "New Application", "DocName": "Passport / Travel Document (Soft copy only) ...

Implement a JavaScript function that loads fresh content onto the webpage without the need to refresh the

$("span.removeFromCart").on("click",function(){ var id = $(this).attr("data-id"); $.ajax({ type: "GET", url: "ajax.php?id="+id+"&action=remove" }) .don ...

Exploring how to alter state in a child component using a function within the parent component in React

class ParentComponent extends Component { state = { isDialogOpen: false, setStyle: false } handleClose = () => { this.setState({ isDialogOpen: false, setStyle: false }) } handleOpen = () => { this.setState({ isDialogOpen: true ...

The useEffect function is not being executed

Seeking assistance from anyone willing to help. Thank you in advance. While working on a project, I encountered an issue. My useEffect function is not being called as expected. Despite trying different dependencies, I have been unable to resolve the issue ...

What is the best way to update just the image path in the source using jQuery?

I am currently working on implementing a dark mode function for my website, and I have successfully adjusted the divs and other elements. However, I am facing an issue with changing the paths of images. In order to enable dark mode, I have created two sep ...