⊗jsvuPmBsOb 8 of 72 menu

Objects in Vue

Now let's say that we have an object written to data:

data() { return { obj: {a: 1, b: 2, c: 3}, } }

Let's print the contents of this object to the screen:

<template> {{ obj.a }} {{ obj.b }} {{ obj.c }} </template>

Or you can use an alternative method:

<template> {{ obj['a'] }} {{ obj['b'] }} {{ obj['c'] }} </template>

Let data store the following object:

data() { return { obj: {x: 1, y: 2, z: 3}, } }

Display the sum of the elements of this object.

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