<!DOCTYPE html> <html lang="zh"> <head> <title></title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <script src="https://unpkg.com/vue/dist/vue.js"></script> <link href="../css/style.css" rel="stylesheet"> </head> <body> <div id="myApp"> <div>今天的天气是<today-weather/></div> </div> <script> Vue.component('today-weather', { template: '<strong>{{todayWeather}}</strong>', data: function(){ return { todayWeather: '雨加雪' }; } }); var myApp = new Vue({ el: '#myApp', }); </script> </body> </html>