]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore(sfc-playground): correctly show selected version on start up
authorEvan You <yyx990803@gmail.com>
Wed, 27 Dec 2023 02:08:26 +0000 (10:08 +0800)
committerEvan You <yyx990803@gmail.com>
Wed, 27 Dec 2023 02:08:26 +0000 (10:08 +0800)
packages/sfc-playground/src/Header.vue

index 49e370e6c3091c6951f4d1ceeaa4113856b8fee5..48585a8e646a0a7437c8df1af450f26a8b51dcf7 100644 (file)
@@ -27,6 +27,12 @@ const { store } = props
 const currentCommit = __COMMIT__
 const vueVersion = ref(`@${currentCommit}`)
 
+const vueURL = store.getImportMap().imports.vue
+if (vueURL && !vueURL.startsWith(location.origin)) {
+  const versionMatch = vueURL.match(/runtime-dom@([^/]+)/)
+  if (versionMatch) vueVersion.value = versionMatch[1]
+}
+
 async function setVueVersion(v: string) {
   vueVersion.value = `loading...`
   await store.setVueVersion(v)