vuejs does not display the value within {{ }}, the text is displayed as is
P粉797004644
P粉797004644 2023-08-30 13:36:59
0
1
594
<p>I developed a vuejs program and ran the <code>npxserve</code> command. I go into that directory and run npxserve. I browse <code>http://localhost:300/myvuefile.html</code> and only get the following output. {{count}} inside the button. My code: </p> <pre class="brush:php;toolbar:false;"><script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> ; <div id="app"> <button @click="count ">{{ count }}</button> </div> <script> import { createApp } from 'vue' const app = createApp({ data() { return { count: 0 } } }) app.mount('#app') </script></pre> <p>I have to get the value of the count and on click the count should be incremented. Instead, I only get {{count}} as output. Please help to resolve this issue. </p>
P粉797004644
P粉797004644

reply all(1)
P粉639667504

According to documentation- p>

So, either use -

like this

const app = Vue.createApp({
  data() {
    return {
      count: 0
    }
  }
})

app.mount('#app')
<div id="app">
  <button @click="count++">{{ count }}</button>
</div>

<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template