赞
踩
现代浏览器大多都已原生支持 ES 模块。因此我们可以像这样通过 CDN 以及原生 ES 模块使用 Vue:
- <!DOCTYPE html>
- <html>
- <head>
- <title>Vue.js 示例</title>
- </head>
- <body>
- <div id="app">
- {{ message }}
- </div>
- <!-- 引入Vue.js -->
- <script type="module">
- import {createApp, ref} from "https://unpkg.com/vue@3/dist/vue.esm-browser.js"
- createApp({
- setup(){
- const message = ref('Hello vue')
- return {
- message
- }
- }
- }).mount('#app')
- </script>
-
-
- </body>
- </html>

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。