1. 程式人生 > >Vue 的setter(設定計算屬性)

Vue 的setter(設定計算屬性)

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta http-equiv="X-UA-Compatible" content="ie=edge">

<script src="https://unpkg.com/vue/dist/vue.js"></script>

<title>Document</title>

</head>

<body>

 

<div id = "myApp">

<today-weather></today-weather>

</div>

 

<script>

 

Vue.component('today-weather',{

template:'<div>今天下雨,出不去吶,在家看youtube吧!</div>'

});

//Vue.compontent('區域性元件名',{template:'區域性元件內容'})

//這裡不知道為什麼,var myApp = new Vue必須在下方,不然還渲染不出來結果

var myApp = new Vue({

el:"#myApp",

});

</script>

</body>

</html>