1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Title</title> 6 <script src="../lib/js/vue.js"></script> 7 </head> 8 <body> 9 <div id="app"> 10 <login></login> 11 </div> 12 <template id="tem"> 13 <h1>这是私有的login组件</h1> 14 </template> 15 <script> 16 const vm = new Vue({ 17 el:'#app', 18 data:{}, 19 methods:{}, 20 filters:{}, //定义私有过滤器 21 directives:{}, //定义私有指令 22 components:{ //定义实例内部私有组件,只能在定义的 vm 实例中使用 23 login:{ 24 template:'#tem' 25 } 26 }, 27 28 beforeCreate() {}, 29 created() {}, 30 beforeMount() {}, 31 mounted() {}, 32 beforeUpdate(){}, 33 updated(){}, 34 beforeDestroy(){}, 35 destroyed(){} 36 }) 37 </script> 38 </body> 39 </html>