|
|
@@ -1,13 +1,13 @@
|
|
|
<script setup lang="ts">
|
|
|
+import { computed } from 'vue'
|
|
|
+import type { ReplStore } from '@vue/repl'
|
|
|
import { downloadProject } from './download/download'
|
|
|
-import { ref } from 'vue'
|
|
|
import Sun from './icons/Sun.vue'
|
|
|
import Moon from './icons/Moon.vue'
|
|
|
import Share from './icons/Share.vue'
|
|
|
import Download from './icons/Download.vue'
|
|
|
import GitHub from './icons/GitHub.vue'
|
|
|
import Reload from './icons/Reload.vue'
|
|
|
-import type { ReplStore } from '@vue/repl'
|
|
|
import VersionSelect from './VersionSelect.vue'
|
|
|
|
|
|
const props = defineProps<{
|
|
|
@@ -27,23 +27,20 @@ const emit = defineEmits([
|
|
|
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]
|
|
|
-}
|
|
|
+const vueVersion = computed(() => {
|
|
|
+ if (store.loading) {
|
|
|
+ return 'loading...'
|
|
|
+ }
|
|
|
+ return store.vueVersion || `@${__COMMIT__}`
|
|
|
+})
|
|
|
|
|
|
async function setVueVersion(v: string) {
|
|
|
- vueVersion.value = `loading...`
|
|
|
store.vueVersion = v
|
|
|
- vueVersion.value = v
|
|
|
}
|
|
|
|
|
|
function resetVueVersion() {
|
|
|
- store.vueVersion = undefined
|
|
|
- vueVersion.value = `@${currentCommit}`
|
|
|
+ store.vueVersion = null
|
|
|
}
|
|
|
|
|
|
async function copyLink(e: MouseEvent) {
|