- Full-Stack Vue.js 2 and Laravel 5
- Anthony Gore
- 130字
- 2021-07-02 19:57:20
Lists section
The next bit of content we'll add to our page is theAmenitiesandPriceslists:

Figure 2.7. Lists section
If you look at the mock-listing sample, you'll see that theamenitiesandpricesproperties on the object are both arrays.
sample/data.js:
var sample = { title: '...', address: '...', about: '...', amenities: [ { title: 'Wireless Internet', icon: 'fa-wifi' }, { title: 'Pets Allowed', icon: 'fa-paw' }, ... ], prices: [ { title: 'Per night', value: '$89' }, { title: 'Extra people', value: 'No charge' }, ... ] }
Wouldn't it be easy if we could just loop over these arrays and print each item to the page? We can! This is what thev-fordirective does.
First, let's add these as data properties on our root instance.
app.js:
data: { ... amenities: sample.amenities, prices: sample.prices }
推薦閱讀
- Designing Machine Learning Systems with Python
- 自己動手寫Java虛擬機
- Python零基礎快樂學習之旅(K12實戰(zhàn)訓練)
- Learning Python Design Patterns(Second Edition)
- Mastering Kali Linux for Web Penetration Testing
- Android Native Development Kit Cookbook
- The DevOps 2.5 Toolkit
- Learning Concurrency in Kotlin
- BeagleBone Robotic Projects(Second Edition)
- JavaScript機器人編程指南
- C語言程序設計與應用實驗指導書(第2版)
- WordPress Search Engine Optimization(Second Edition)
- WCF技術剖析(卷1)
- PHP+MySQL Web應用開發(fā)教程
- 從零開始構建深度前饋神經(jīng)網(wǎng)絡:Python+TensorFlow 2.x