Vue Tip: Check Version at Runtime

April 10, 2022
|1 Minuten Lesezeit
|- Ansichten
April 10, 2022
1 Minuten Lesezeit
|- Ansichten
It’s possible to check Vue’s version at runtime by importing version
from the Vue npm package and splitting the string at the .
character:
<template>
<h1>Vue Version: {{ vueVersion }}</h1>
</template>
<script setup>
import { version } from 'vue';
const vueVersion = version.split('.')[0];
</script>
If you liked this tip, follow me on Twitter to get notified about new tips, blog posts, and more content from me.
Alternatively (or additionally), you can also subscribe to my newsletter.
Sie haben einen Fehler in diesem Artikel gefunden? Sie möchten gerne etwas klarstellen, aktualisieren oder hinzufügen?
Alle meine Artikel können auf Github editiert werden. Jeder Fix ist willkommen, egal wie klein er sein mag!
Ändern auf Github