- 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 }
推薦閱讀
- Cocos2D-X權威指南(第2版)
- Java系統分析與架構設計
- SpringMVC+MyBatis快速開發與項目實戰
- Android 9 Development Cookbook(Third Edition)
- Instant Typeahead.js
- 微信小程序開發解析
- Unity Game Development Scripting
- 打開Go語言之門:入門、實戰與進階
- INSTANT Yii 1.1 Application Development Starter
- Getting Started with Nano Server
- .NET 4.0面向對象編程漫談:應用篇
- 軟件測試分析與實踐
- Learning WordPress REST API
- Building Apple Watch Projects
- HTML5+CSS3+jQuery Mobile+Bootstrap開發APP從入門到精通(視頻教學版)