<html> <script src="https://unpkg.com/vue@next"></script> <body> <div id="vue"> <div v-html="rhtml"></div> <props-demo-simple></props-demo-simple> </div> </body> <script> const htmls = { data() { return { rhtml: "<h1>html页面中引用VUE3的演示页面</h1>", } } } const app = Vue.createApp(htmls) // 简单语法注册或获取全局组件.注册还会自动使用给定的 id 设置组件的名称 app.component( 'props-demo-simple', { data() { return { count: 0 } }, props: ['size', 'myMessage'], template: `<button v-on:click = "count++" > You clicked me {{ count }} times. </button>` } ) app.mount("#vue") </script> </html>