<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>組件定義</title> <link rel="stylesheet" type="text/css" href="css/animate.css"> </head> <script type="text/javascript" src="js/vue.js" ></script> <body> <div id="div1"> <my-hello></my-hello> </div> </body> <script> Vue.component('my-hello',{ template: 'hello world!' }); let vm = new Vue({ el: "#div1", data:{ flag:false }, }); </script> </html>