1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Vue</title> 6 <style> 7 8 </style> 9 </head> 10 <body> 11 <div id="app"> 12 <child-component></child-component> 13 </div> 14 <!-- 开发环境版本,包含了用帮助的命令行警告 --> 15 <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> 16 <script type="text/javascript"> 17 Vue.component('child-component', function(resolve, reject) { 18 window.setTimeout(function() { 19 resolve({ 20 template: '<div>异步渲染</div>' 21 }) 22 }, 2000); 23 }) 24 var app = new Vue({ 25 el:'#app' 26 27 }); 28 29 </script> 30 </body> 31 </html>