获取你的 Vue 服务器
App.vue
main.js
 
<template>
  <h1>v-on Example</h1>
  <p>The '.prevent' modifier is set to prevent the drop down menu to appear when the user does a right mouse button click.</p>
  <div 
    v-on:click.right.prevent="changeColor" 
    v-bind:style="{ backgroundColor: 'hsl(' + bgColor + ',80%,80%)' }">
    <p>Press right mouse button here.</p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      bgColor: 0
    }
  },
  methods: {
    changeColor() {
      this.bgColor += 50
    }
  }
}
</script>

<style scoped>
div {
  margin: 10px;
  padding: 10px;
  border: dashed black 1px;
  width: 200px;
}
</style>                  
import { createApp } from 'vue'

import App from './App.vue'

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