Skip to content

Commit

Permalink
chore(sfc-playground): correctly show selected version on start up
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Dec 27, 2023
1 parent 9183069 commit 9e529f8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/sfc-playground/src/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9e529f8

Please sign in to comment.