<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> </head> <body> <script type="module"> const { createApp ,reactive ,ref} = Vue createApp({ setup() { const counter = reactive({ count: 0 }) const message = ref('Hello World!') return { counter, message } } }).mount('#app') </script> <div id="app"> <h1>{{ message }}</h1> <p>Count is: {{ counter.count }}</p> </div> </body> </html>
标签:count,const,ref,counter,reactive,vue3,message,写法,页面 From: https://www.cnblogs.com/dj258/p/17589485.html