ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
>[success] # 快速使用 通过 `CDN ` 的方式使用 引入`https://unpkg.com/vue@next` ~~~ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Document</title> </head> <body> <div id="app"></div> <!-- 通过cdn 引入 --> <script src="https://unpkg.com/vue@next"></script> <script> const app = Vue.createApp({ template: ` <h2> {{ title }}</h2> <div>{{count}} </div> <button @click="add">+</button> <button @click="sub">-<span> `, data() { return { title: '测试数据', count: 1, } }, methods: { add() { this.count++ }, sub() { this.count-- }, }, }) app.mount('#app') </script> </body> </html> ~~~ * 直接绑定节点 ~~~ <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <div id="app"> <h2>当前计数: {{counter}}</h2> <button @click="increment">+1</button> <button @click="decrement">-1</button> </div> <script src="./lib/vue.js"></script> <script> const app = Vue.createApp({ data: function() { return { counter: 0 } }, methods: { increment: function() { this.counter++ }, decrement: function() { this.counter-- } } }) app.mount("#app") </script> </body> </html> ~~~