v-else-if not working in vuejs : Failed to resolve directive: else-if

devendra picture devendra · Jul 17, 2017 · Viewed 8.7k times · Source

I am using "if" and "else-if" but is giving me compilation error.

[Vue warn]: Failed to resolve directive: else-if

this is my code

Please help me to resove this.

Answer

Vamsi Krishna picture Vamsi Krishna · Jul 17, 2017

v-else-if is added in vue 2.1.0 but you are using version 1.0.28, that's why the error, update the vue version or use v-if only

<span v-if="lab_status==0">Inactive</span> 
<span v-if="lab_status==1">Active</span> 
<span v-if="lab_status!=1 && lab_status!=0">Expired</span>

See v-else-if