- 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 }
推薦閱讀
- 精通Nginx(第2版)
- Java完全自學教程
- JIRA 7 Administration Cookbook(Second Edition)
- Learning ASP.NET Core 2.0
- 數據結構與算法JavaScript描述
- Processing互動編程藝術
- 自制編程語言
- 單片機C語言程序設計實訓100例
- Visual Basic程序設計實驗指導(第二版)
- SSH框架企業級應用實戰
- 快樂編程:青少年思維訓練
- 軟件設計模式(Java版)
- MySQL數據庫教程(視頻指導版)
- Unreal Engine Game Development Cookbook
- Mastering PostgreSQL 11(Second Edition)