⊗jsvuPmBsAr 7 of 72 menu

Arrays in Vue

Displaying array contents in Vue is done the same way as in pure JavaScript. Let's see how it's done. Let's say in data we have a property arr that contains some array inside:

data() { return { arr: [1, 2, 3], } }

Let's print the elements of this array:

<template> {{ arr[0] }} {{ arr[1] }} {{ arr[2] }} </template>

Let data store the following array:

data() { return { arr: ['x', 'y', 'z'], } }

Print each element of this array in a separate paragraph.

Let data store the following array:

data() { return { arr: [1, 2, 3], } }

Display the sum of the elements of this array.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline