<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Component 组件props 属性设置</title> <meta name="flexible" content="initial-dpr=2,maximum-dpr=3" /> <meta name="apple-mobile-web-app-capable" content="yes"> <meta content="yes" name="apple-touch-fullscreen"> <meta content="telephone=no,email=no" name="format-detection"> <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"> <script src="../assets/js/flexible_css.js"></script> <script src="../assets/js/flexible.js"></script> <script src="../assets/js/vue.js"></script> </head> <body> <div id="app"> <caicai></caicai> </div> </body> <script type="text/javascript"> var jinsuo={ template:`<p>我是子组件内容</p>` } var cai={ template:`<div><p>我是父组件</p><suo></suo></div>`, //父组件模版里插入 子组件 components:{ //这是子组件 ‘suo‘:jinsuo //子组件模版是上面的 变量jinsuo } } var app=new Vue({ el:"#app", data:{ }, components:{ ‘caicai‘:cai } }) </script> </html>