Javascript is required
·
0 min read
·
407 views

Vue Tip: Check Version at Runtime

Vue Tip: Check Version at Runtime Image

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:

1<template>
2  <h1>Vue Version: {{ vueVersion }}</h1>
3</template>
4
5<script setup>
6import { version } from 'vue'
7
8const vueVersion = version.split('.')[0]
9</script>

Demo

If you liked this Vue tip, follow me on X to get notified about new tips, blog posts, and more. Alternatively (or additionally), you can subscribe to my weekly Vue & Nuxt newsletter:

I will never share any of your personal data. You can unsubscribe at any time.