官术网_书友最值得收藏!

  • Vue.js 2.x by Example
  • Mike Street
  • 209字
  • 2021-07-02 20:00:25

Displaying, Looping, Searching, and Filtering Data

In Chapter 1Getting Started with Vue.js, we covered the data, computed, and method objects within Vue and how to display static data values. In this chapter, were are going to cover:

  • Displaying lists and more complex data with Vue using v-ifv-elseand v-for
  • Filtering the lists using form elements
  • Applying conditional CSS classes based on the data

The data we are going to be using is going to be randomly generated by the JSON generator service (http://www.json-generator.com/). This website allows us to get dummy data to practice with. The following template was used to generate the data we will be using. Copy the following into the left-hand side to generate data of the same format so the attributes match with the code examples, as follows:

      [
'{{repeat(5)}}',
{
index: '{{index()}}',
guid: '{{guid()}}',
isActive: '{{bool()}}',
balance: '{{floating(1000, 4000, 2, "00.00")}}',
name: '{{firstName()}} {{surname()}}',
email: '{{email()}}',
registered: '{{date(new Date(2014, 0, 1), new Date(), "YYYY-
MM-ddThh:mm:ss")}}'
}
]

Before we get into building our simple app and displaying our users, we'll cover some more of the features of Vue and the HTML-specific attributes available in your view. These range from dynamically rendering content to looping through arrays.

主站蜘蛛池模板: 清徐县| 茌平县| 西贡区| 胶州市| 上栗县| 香港| 北宁市| 奉节县| 密山市| 毕节市| 开封县| 雷山县| 英吉沙县| 老河口市| 新乐市| 鹰潭市| 南江县| 五峰| 平邑县| 教育| 林州市| 清苑县| 大石桥市| 兰州市| 宁河县| 阳泉市| 平舆县| 昆明市| 江孜县| 大兴区| 龙胜| 梓潼县| 青海省| 华蓥市| 黄龙县| 邵阳市| 资溪县| 西安市| 黄梅县| 五常市| 楚雄市|