[Vuejs]-How do I display "Not connected" only when my API returns "null" string type in the context of Vuejs

0👍

What you could do is use ternary operator to switch between connected and not connected text based on status as so instead of using v-if(if used needs else span also and your status should be of type string and null as per your given code,if not string then just use v-if="status" and v-else):

<div class="api_data">
    <span class="trick_ok">{{this.status=='connected'?'Connected':'Not connected'}}</span>
</div>

Leave a comment