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')
                  
http://localhost:5173/