Why is the v-for
loop over an enum
displaying both names and values?
Is there a way to iterate only over the keys?
export enum Colors {
"RED" = 1,
"BLUE" = 2,
"GREEN" = 3,
}
<template>
<div>
<v-chip v-for="key in Colors" :key="key">{{key}}</v-chip>
</div>
</template>
<script lang="ts">
import {Colors} from "./Enums"
import Vue from "vue";
export default Vue.extend({
data: () => ({
Colors,
}),
});
</script>
The current behavior results in 6 chips, while I expected only 3.
- RED
- BLUE
- GREEN
- 1
- 2
- 3