<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>定义子组件</title> </head> <body> <script src="vue1.0.11.js"></script> </body> <div id="app"> <account></account> </div> <script> //定义一个账号组件 Vue.component('account',{ template:'<h1>账号组件</h1><login></login>',//在这里使用登录组件 //在账号组件中定义一个登录的子组件 components:{ 'login':{ template:'<h2>登录子组件</h2>' }//组件的名字就叫做login } }) new Vue({ el:'#app', }); </script> </html>
vue在组件里面注册子组件
猜你喜欢
转载自blog.csdn.net/weixin_40593587/article/details/79293419
今日推荐
周排行