Level 5
Maybe you can use v-if directive like this:
<td v-if="document">@{ document }</td>
<td v-if="!document"><button></td>
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Any suggestions on how to check if the object in the list is null or empty? See example below.
array:2 [▼
0 => array:4 [▼
"id" => 1
"title" => "Notice of Award (Email)"
"remarks" => "Sample Description"
"document" => "confirmation.email"
]
1 => array:4 [▼
"id" => 2
"title" => "Assignment Order (AO)"
"remarks" => null
"document" => null
]
ready: function() {
this.fetchRequirements();
},
methods: {
fetchRequirements: function() {
var url = '/api/project/' + this.projectSlug + '/requirements';
this.$http.get(url, function(data) {
this.$set('requirements', data)
});
}
}
<tr v-repeat="requirements">
<td>@{ id }</td>
<td>@{ title }</td>
<td>@{ remarks }</td>
<td>@{ document }</td>
</tr>
Note: Those are double curly braces.
This is working correctly but I just want to check
IF document object is null i will display a button
ELSE display normal @{ document }
Any suggestion on how to implement this? :)
Thanks in advance! :)
Maybe you can use v-if directive like this:
<td v-if="document">@{ document }</td>
<td v-if="!document"><button></td>
Please or to participate in this conversation.