refactor(editor): Migrate VersionCard.vue to use composition API (no-changelog) (#9799)

This commit is contained in:
Ricardo Espinoza 2024-06-19 09:36:38 -07:00 committed by GitHub
parent f6b8b8d956
commit 106b0ac1a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -44,36 +44,30 @@
v-for="node in version.nodes"
:key="node.name"
:node-type="node"
:title="$options.nodeName(node)"
:title="nodeName(node)"
/>
</div>
</div>
</a>
</template>
<script lang="ts">
import type { PropType } from 'vue';
import { defineComponent } from 'vue';
<script setup lang="ts">
import NodeIcon from './NodeIcon.vue';
import TimeAgo from './TimeAgo.vue';
import Badge from './Badge.vue';
import WarningTooltip from './WarningTooltip.vue';
import type { IVersionNode, IVersion } from '@/Interface';
import type { IVersion, IVersionNode } from '@/Interface';
import { useI18n } from '@/composables/useI18n';
export default defineComponent({
name: 'VersionCard',
components: { NodeIcon, TimeAgo, Badge, WarningTooltip },
props: {
version: {
type: Object as PropType<IVersion>,
required: true,
},
},
// @ts-ignore
nodeName(node: IVersionNode): string {
return node !== null ? node.displayName : this.$locale.baseText('versionCard.unknown');
},
});
defineProps<{
version: IVersion;
}>();
const i18n = useI18n();
const nodeName = (node: IVersionNode): string => {
return node !== null ? node.displayName : i18n.baseText('versionCard.unknown');
};
</script>
<style module lang="scss">