[Vuejs]-Adding conditional Components to template Vuejs

0👍

Try to name the components with LOGIN and LOGOUT as in logTypes object:


components:{
   LOGIN:LogTypeLogin ,
   LOGOUT:LogTypeLogout
}

then use the buitl-in component component and bind the is prop to item.action :


<template #item.event="{ item }">
  <component v-if="item.action" :is="item.action" :item="item" />
  <div v-else>
    Nothing
  </div>
</template>

Leave a comment