0👍
✅
Hello and welcome to Stack Overflow! Your message
Array is being mapped correctly with mapGetters
, but you’re flattening it as a String when you put it inside the template with {{message}}
, since the template interpolation logic covert objects to strings, the same as calling Array.toString
in this case. You need to iterate it, i.e. using the v-for
directive:
<template>
<body>
<div class="container">
<h1 v-show="elementVisible" class="info">
<span v-for="m of message" :key="m">{{m}}</span>
</h1>
</div>
</body>
</template>
Of course, if you only need the first item, you could show it directly using:
<template>
<body>
<div class="container">
<h1 v-show="elementVisible" class="info">{{message[0] || 'No message'}}</h1>
</div>
</body>
</template>
Source:stackexchange.com