Templates of vue

6 篇文章 0 订阅

Templates of vue

image.png

// UI
<div v-for="beer in beers">
	<div>
		<h5>{{ beer.name }}</h5>
		<small style="color:gray">
			abv: {{ beer.abv }}
		</small>
	</div>
</div>

// Data and Business Logic
beers: [
	{ name:'Ahool Ale', abv:5.4 },
	{ name:'Sigbin Stout', abv:8.1 }
]

----------------------------------------------

image.png
Tmplate

// Data
data: {
	name: '',
	picture: 'http://site.com/...jpg',
	stats: {
		pct: .521,
		ppg: 22.3,
		rpg: 7.4
	}
}
// HTML
<div class="card">
	<img :src="picture">
	<h4>{{ name }}</h4>
	<ul>
		<li>fg %: {{ stats.pct }}</li>
		<li>ppg: {{ stats.ppg }}</li>
		<li>rpg: {{ stats.rpg }}</li>
	</ul>
</div>

https://upload.wikimedia.org/wikipedia/commons/d/d3/LeBron_James_(15847318851).jpg

Templates:

  • Minimize the amount of code you write
  • Protect you from changes

-----------------------------------------------------

Declarative Bindings:

  • Simplify development
  • Remove the burden of managing the DOM
  • Updates happen automatically

Vue provides an answer to the issue of JavaScript fatigue, and it is a worthy successor to the legacy of jQuery

------------------------------------

Virtual DOM

  • Lightweight copy of the actual DOM
  • Efficiently determines what needs to be updated
  • Batches updates

Installing and Setting up Vue
http://blog.csdn.net/u012596785/article/details/79463568

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值