1 Star 0 Fork 455

李刘玉/Vue.js入门课程

forked from 小马/Vue.js入门课程 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.html 1.15 KB
一键复制 编辑 原始数据 按行查看 历史
koma 提交于 2017-01-25 09:11 +08:00 . 观察属性
<!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">
<p>今年3月3日发卖的任天堂新一代主机Switch的价格是:{{price}}円,含税价格为:{{priceInTax}}円,折合人民币为:{{priceChinaRMB}}元。</p>
<button @click="btnClick(10000)">加价10000円</button>
</div>
<script>
var myApp = new Vue({
el: '#myApp',
data: {
price: 0,
priceInTax: 0,
priceChinaRMB: 0,
},
watch: {
price: function(newVal, oldVal){
console.log(newVal, oldVal);
this.priceInTax = Math.round(this.price * 1.08);
this.priceChinaRMB = Math.round(this.priceInTax / 16.75);
},
},
methods: {
btnClick: function(newPrice){
this.price += newPrice;
},
},
});
myApp.price = 29980;
</script>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/MrLly/LearnVueJS.git
git@gitee.com:MrLly/LearnVueJS.git
MrLly
LearnVueJS
Vue.js入门课程
master

搜索帮助