Apologies for the vague title, but I need some help with a question regarding my web application built with vueJS.
Within this application, I have a simple table that displays data fetched from the server in an array of objects. Each object contains various properties.
My goal is to show specific data in the table and hide any properties that are not provided by the server. However, I still want to maintain the structure of the table, with the missing properties displaying as empty spaces.
Here is how I attempted to solve it:
<div :style="{'visibility': computedValue}"></div>
The computed value is a property that determines whether to show or hide the element based on the data received.
Unfortunately, I encountered some issues when handling properties that may be undefined, leading to errors when using :style
.
Coming from an Angular background, I'm familiar with the differences between v-if
and v-show
. In Vue, however, even when attempting to use v-show
for showing/hiding elements, it behaves more like v-if
, removing the element rather than keeping it visible with an empty space, which is what I desire.
Can anyone provide advice or explanations on how to achieve this?