127. python高级------vue(7)
python修炼第二十九天
2019年 4月 29日 晴
计算属性
<!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">
<title>Document</title>
<script src="./vue.min.js"></script>
<script>
window.onload = function () {
new Vue({
el: "#app",
data: {
msg: "hello"
},
computed: {
reverseMsg: function () {
return this.msg.split('').reverse().join("")
}
},
})
}
</script>
</head>
<body>
<div id="app">
<!-- 使用js对象内置的方法 -->
<!-- {{ msg.split('').reverse().join("") }} -->
<!-- 使用计算属性来封装处理 -->
{{reverseMsg}}
</div>
</body>
</html>
<!--
class Dog:
@propery
def age(self):
pass
@age.setter
def age(self, value):
pass
dog1 = Dog()
dog1.age = 20
print(dog1.age)
-->