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.</p>
<div
v-on:click="$data.color+=100"
v-bind:style="{backgroundColor:'hsl('+$data.color+',80%,80%)'}"
>
<p>Click here</p>
</div>
</template>
<script>
export default {
data() {
return {
color: 100
}
}
}
</script>
<style scoped>
div {
border: solid black 1px;
width: 100px;
cursor: pointer;
padding: 25px 0;
text-align: center;
}
</style>
import { createApp } from 'vue'
import App from './App.vue'
const app = createApp(App)
app.mount('#app')