- Full-Stack Vue.js 2 and Laravel 5
- Anthony Gore
- 80字
- 2021-07-02 19:57:13
Directives
Similar to Angular, we can add functionality to our templates by using directives. These are special properties we add to HTML tags starting with thev-prefix.
Say we have an array of data. We can render this data to the page as sequential HTML elements by using thev-for directive:
<p id="app"> <h3>Grocery list</h3> <ul> <li v-for="grocery in groceries">{{ grocery }}</li> </ul> </p> <script> var app = new Vue({ el: '#app', data: { groceries: [ 'Bread', 'Milk' ] } }); </script>
The preceding code renders as follows:
<p id="app"> <h3>Grocery list</h3> <ul> <li>Bread</li> <li>Milk</li> </ul> </p>
推薦閱讀
- ASP.NET Core 5.0開發(fā)入門與實戰(zhàn)
- Python深度學(xué)習(xí)
- AIRAndroid應(yīng)用開發(fā)實戰(zhàn)
- Oracle BAM 11gR1 Handbook
- Learning Vaadin 7(Second Edition)
- 從零開始:UI圖標(biāo)設(shè)計與制作(第3版)
- OpenMP核心技術(shù)指南
- 石墨烯改性塑料
- 遠(yuǎn)方:兩位持續(xù)創(chuàng)業(yè)者的點(diǎn)滴思考
- Scala Functional Programming Patterns
- 愛上C語言:C KISS
- C#程序設(shè)計基礎(chǔ)入門教程
- 例解Python:Python編程快速入門踐行指南
- Spring Boot 2+Thymeleaf企業(yè)應(yīng)用實戰(zhàn)
- Analytics for the Internet of Things(IoT)