Why does this v-for loop over an enum show the names and values?
How can I 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>
This strangely results in 6 chips, but I would expect only 3.
- RED
- BLUE
- GREEN
- 1
- 2
- 3
Colorsas anObject.Object.keys()doesn't fix this.