>>102397392
>vue is comfy too
True, but ONLY if you use setup
Without setup (pig disgusting):
<script lang="ts">
// ...
import { defineComponent, computed } from "vue";
export default defineComponent({
props: {
myMetric: {
type: Object as PropType<Metric>,
required: true,
},
},
setup(props) {
const metricName = computed(() => props.myMetric.name);
return {
metricName,
};
},
});
</script>
With script setup:
<script setup lang="ts">
// ...
import { computed, PropType } from "vue";
const props = defineProps({
myMetric: {
type: Object as PropType<Metric>,
required: true,
},
});
const metricName = computed(() => props.myMetric.name);
</script>