获取您的自己的 Vue 服务器
App.vue
main.js
 
<template>
  <h2>Example $data Object</h2>
  <p>Using the $data object to change the color data property inside the Vue instance when the DIV box is clicked.</p>
  <div 
    v-bind:style="{backgroundColor:$data.color}"
    v-on:click="changeColor"
  >
    <p>Click me</p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      color: 'lightgreen'
    }
  },
  methods: {
    changeColor() {
      this.$data.color = 'pink';
    }
  }
}
</script>

<style scoped>
div {
  border: solid black 1px;
  width: 100px;
  cursor: pointer;
  text-align: center;
  padding: 20px 0;
}
</style>                  
import { createApp } from 'vue'

import App from './App.vue'

const app = createApp(App)
app.mount('#app')
                  
https://127.0.0.1:5173/