<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>数据, 方法, 计算方法和侦听器</title>
<script src="https://unpkg.com/vue@next"></script>
</head>
<body>
<div id="root"></div>
<script type="text/javascript">
const app = Vue.createApp({
data() {
return {
message: 'Hello',
price: 8,
num: 2
}
},
watch: {
price(newprice, net){
console.log(newprice, net)
}
},
computed:{
total(){
return this.price * this.num;
}
},
methods: {
handleClick(str){
return str = str.toUpperCase();
},
totalFun(){
console.log();
return this.price * this.num;
}
},
template: `
<div> {{handleClick(message)}} </div>
<div> {{total}} </div>
<div> {{totalFun()}} </div>
`
})
var vm = app.mount("#root");
</script>
</body>
</html>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)