316 字
2 分钟阅读
Vue – 在html中引入

简介

html引入Vue

代码演示

<html>
    <head>
        <title>html 引入 Vue</title>
    </head>
    <body> 
        <div id = "app">
            <!-- 插值表达式 -->
            {{ message }}
        </div>
        <h1>{{count}}</h1>
        <script type="module">
            import { createApp, ref } from 'https://unpkg.com/vue@3/dist/vue.esm-browser.js'
                createApp({
                    data(){
                        return {
                            message: 'Hello Vue!',
                            count: 150
                        }
                    }
                }).mount('#app')
        </script>
    </body>
</html>

效果

发表评论

您的邮箱地址不会被公开。 必填项已用 * 标注