I am facing an issue where my component template is unable to locate the value property specified in the <script> section of VueJS

My app seems to be having trouble reading the value variable that I defined in the data section. It's strange because Npm compiles everything without throwing any errors.

If you want to take a look at my code, here's the fiddle link: https://jsfiddle.net/invinivi/yr164pb7/

<template>
  <div id="exercise">
    <div>
      <p>Current Value: {‌{ value }}</p>
      <button @click="value += 5">Add 5</button>
      <button @click="value += 1">Add 1</button>
      <p>{‌{ result }}</p>
    </div>
    <div>
      <input type="text">
      <p>{‌{ value }}</p>
    </div>
  </div>
</template>

<script>
    export default {
        name: 'Ex3',
        el: '#exercise',
        data: function () {
            return {
                value: 0
            }
        },
        computed: {
            result: function () {
                return this.value == 37 ? 'done' : 'not there yet';
            }
        },
        watch: {
            result: function () {
                var vm = this;
                setTimeout(function () {
                    vm.value = 0;
                }, 5000);
            }
        }
    }
</script>
// FILE - Ex3.vue

<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<template>
  <div id="app">
    <Ex3/>
  </div>
</template>

<script>
import Ex3 from "./components/Ex3"

export default {
  name: 'App',
  components: {
    Ex3
  }
}
</script>

Answer №1

Incorrect encoding of curly brackets was causing issues due to Windows settings. Once the settings were switched to utf-8, all operations went smoothly.

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

Translate unknown provider in Angular using $translateProvider

Here is the situation I am facing: I am working on an Ionic project and I want to implement internationalization using angular-translate. To achieve this, I have added angular-translate.min.js to my project: <script src="lib/ionic/js/ionic.bundle.js"&g ...

Create a function that will repeatedly call itself at specified intervals, increment a variable, and update the class values of elements with an id matching the current value of the

I'm attempting to create a setup that cycles through different images <div id="img_box" class="shadow" onload="imgCycle(1)";> <img id="1" class='opaque imgbox selected' src="media/img ...

Utilizing React-toastify across various components

My main project, which we'll call ProjectA, imports multiple React components, including a federated module called ProjectB. Within ProjectA, I have installed and imported the react-toastify container in the App.js. ProjectB is also imported into App. ...

Find a way to incorporate social media features into a web application that functions intermittently

Currently, I am in the process of developing a social media app and working on integrating a search feature to enable users to find friends. The code I have below seems to be functional at times but not consistent (quite frustrating!) The issue seems to st ...

Creating a randomized number within the nested click event's inner function

One of the challenges I'm facing is trying to generate a single random number within a nested event click function. Unfortunately, when running the code, instead of getting a single number, I end up with multiple random numbers being output. The spec ...

Creating a Vue.js v-for loop to dynamically display a series of DIVs in segments

Here is the code I am currently working with: <div class="container-fluid" id="networdapp" style="display:none;"> <div class="row" > <div v-for="(result,i) in results" :key="i" class="col-sm-6" > <div class=" ...

Error encountered in my JavaScript file - Unexpected Token < found on line 1 of the loadash.js script

I am right at the end of creating a sample dashboard with charts using dc.js, but I have hit a roadblock with one error remaining. This error is causing an issue. Unexpected token < on line 1 for loadash.js. The loadash.js file is valid, but for som ...

Develop a Vue app specifically designed as a component to seamlessly integrate with another project's Vue router

I am working on developing a Vue app that can be used as a component for other Vue projects in the app's Vue router. To start, here is my simple project structure: |-- my-app |-- lib |-- my-app-component <-- folder copied from (my-app- ...

After adding elements with jQuery, make sure to select them correctly

When I click a button on my page, it appends an element with the class .select2-selection__rendered. I need to get the text of this appended element for use in an AJAX call. However, when I tried to alert its text, I found that it was blank. The appending ...

Conceal a div when the user is browsing within a Facebook page tab

I am trying to create a webpage that can be accessed directly or through a Facebook page tab. My goal is to only display a Facebook logo if the user is accessing the page outside of Facebook. If they are already viewing the page within Facebook, I don&ap ...

arrange the elements in a specified sequence

I am trying to sort an array in a specific order var customOrder = { "1st Presentation / Meeting": 0, "Follow-On Meetings": 1, "Hold\/Uncategorized": 2, "MGL": 3, "PGL": 4, "BGL": 5, "RGL": 6, "SGL": 7, "Uncategorized Leads": 8, ...

Angular BehaviorSubject is failing to emit the next value

I am facing an issue with a service that uses a Behavior subject which is not triggering the next() function. Upon checking, I can see that the method is being called as the response is logged in the console. errorSubject = new BehaviorSubject<any> ...

Persisting Undefined Values Even After Proper Prop Passing

I'm currently working on fetching and passing coaching data as props to another component for rendering on the frontend. I need to pass these props to the CoachingCard Component in order to display the coaching values. However, I'm encountering ...

Leverage the LatLng retrieved from autocomplete to locate a nearby destination with the help of vue-google

Having an autocomplete feature on my landing page allows me to collect user address details like latitude, longitude, and address. After capturing these details, I store them using the following commit method: locate ({commit}, payload) { commit(&a ...

Issue encountered while creating Google Chart with a CSV file stored locally

I am working on an HTML project where I am uploading a local CSV file, and my goal is to utilize the Google Charts API to create a chart from the data. However, I am encountering an error that states: script.js:29 Uncaught TypeError: Cannot read property ...

Issue with selecting rows in DataTable on subsequent pages

I am currently working on an ASP.NET MVC web application and encountering some issues with a jQuery dataTable. The table is being populated correctly with data from a ViewBag, so that part is working fine. <div> <table id="invoiceTable"> ...

What are the steps to achieve complete test coverage for my Angular login form? Encountering an issue with reading property 'subscribe' of undefined

Recently, I made adjustments to my login component to align more closely with Angular standards. However, upon testing, I encountered errors of this kind: Cannot read property 'subscribe' of undefined After using console.log for debugging pur ...

What exactly does Vue :state mean?

While exploring , I encountered a Vue attribute called :state. I couldn't find any information about it in the documentation and now I am confused. Where does it come from and what is its purpose? It seems like I need to use this to validate an input ...

I am unable to access the Dynamsoft ResourcesPath

Dynamsoft.DWT.ResourcesPath = "dwt-resources" Package.json "scripts": { "dev": "ncp node_modules/dwt/dist static/dwt-resources && nuxt", "build": "nuxt build", "start": &q ...

Guide on connecting a Vue Bootstrap Modal to an alternative container?

I am currently facing an issue with a Vue Bootstrap Modal not displaying correctly. The problem arises because its parent (or an ancestor further up the hierarchy) has an overflow:hidden property set. Is there a way to make the modal attach to the body el ...