Vue自定義組件

<!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: '<h1>hello world!</h1>' }); let vm = new Vue({ el: "#div1", data:{ flag:false }, }); </script> </html>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章