Last active
July 27, 2022 06:28
-
-
Save Faizanq/6bcf62b6d60f87e316b505d2c2694b94 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="widget"> | |
<div v-if="activeItems && activeItems.length > 0"> | |
<ul> | |
<li v-for="item in activeItems" :key="item.id"> | |
{{item.name}} | |
</li> | |
</ul> | |
</div> | |
</div> | |
</template> | |
<script> | |
export default { | |
data() { | |
return { | |
loading: true, | |
list: { | |
'John': true, | |
'Jane': true, | |
'Bob': false | |
}, | |
} | |
}, | |
computed: { | |
activeItems() { | |
return Object.keys(this.list).map(key=>{ return {name:key,active:this.list[key]}}).filter(item=>item.active); | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment