Nhận máy chủ Vue của riêng bạn
Ứng dụng.vue
main.js
 <template> <h1>Add/Remove &lt;p&gt; Tag</h1> <button @click="this.exists = !this.exists">{{btnText}}</button><br> <p v-if="exists">Hello World!</p> </template> <script> export default { data() { return { exists: false } }, computed: { btnText() { if(this.exists) { return 'Remove'; } else { return 'Add'; } } } } </script> <style> p { background-color: lightgreen; display: inline-block; padding: 10px; } </style>
 import { createApp } from 'vue' import App from './App.vue' const app = createApp(App) app.mount('#app')
https://localhost:5173/