[Vuejs]-VueJs using simple v-if statement for computeds not working

3👍

As long as your string has a space in it, it will never be equivalent to '', so the condition in your v-if binding will always return false. Instead, String.prototype.trim() and simply allow the returned string to be evaluated as truthy/falsy:

<span v-if="profile_full_name.trim()">
    @{{ profile_full_name }}
</span>
<span v-else>
    {{auth()->user()->fullName}}
</span>
👤Terry

Leave a comment