获取您的自己的 Vue 服务器
App.vue
main.js
 
<template>
  <h1>Example</h1>
  <p>Click the button to put "Hello!" as the text in the green p element.</p>
  <button @click="changeVal">Change Text</button><br>
  <p ref="pEl" id="pEl">This is the initial text</p>
</template>

<script>
  export default {
    methods: {
      changeVal() { 
        this.$refs.pEl.innerHTML = "Hello!";
      }
    }
  };
</script>

<style>
#pEl {
  background-color: lightgreen;
  display: inline-block;
}
</style>                  
import { createApp } from 'vue'

import App from './App.vue'

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