JSFiddle - React, Tailwind, and code Playground

by imall

HTML

<script src="https://unpkg.com/vue@3.3.4/dist/vue.global.js"></script>
    <div id="app">
     <div>
     原始資料:  <span v-once @click="plus">{{number}}</span>
     </div> 
     
     <div>
    新的資料:   <span  @click="plus">{{number}}</span>
     </div>
     
     <button @click="plus">點我</button>

    </div>

JavaScript

const {ref}= Vue

const app = Vue.createApp({
    setup(){
        const number = ref(0)
        const plus = ()=>{
             number.value++
            console.log(number.value)
           
        }
        return { number,plus }
    }
}).mount('#app')