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: 'hello world!'
        });
        let vm = new Vue({
            el: "#div1",
            data:{
                flag:false
            },
        });
    </script>
</html>
相關文章
相關標籤/搜索