- 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 }
推薦閱讀
- Getting started with Google Guava
- MySQL 8從入門到精通(視頻教學版)
- Learning Chef
- Python網(wǎng)絡(luò)爬蟲從入門到實踐(第2版)
- C#程序設(shè)計(慕課版)
- Python貝葉斯分析(第2版)
- Hands-On Automation Testing with Java for Beginners
- 0 bug:C/C++商用工程之道
- 基于SpringBoot實現(xiàn):Java分布式中間件開發(fā)入門與實戰(zhàn)
- Learning Hadoop 2
- Red Hat Enterprise Linux Troubleshooting Guide
- Learning Concurrency in Python
- Mastering PowerCLI
- 企業(yè)級Java現(xiàn)代化:寫給開發(fā)者的云原生簡明指南
- 精益軟件開發(fā)管理之道