|
1 | 1 | <script setup lang="ts"> |
2 | 2 | import { downloadProject } from './download/download' |
3 | | -import { ref, onMounted } from 'vue' |
| 3 | +import { ref, onMounted, defineEmits, computed } from 'vue' |
4 | 4 | import Sun from './icons/Sun.vue' |
5 | 5 | import Moon from './icons/Moon.vue' |
6 | 6 | import Share from './icons/Share.vue' |
7 | 7 | import Download from './icons/Download.vue' |
8 | 8 | import GitHub from './icons/GitHub.vue' |
9 | 9 |
|
10 | 10 | // @ts-ignore |
11 | | -const { store } = defineProps(['store']) |
| 11 | +const { store, autoUrl } = defineProps(['store', 'autoUrl']) |
| 12 | +const emit = defineEmits(['update:autoUrl']); |
12 | 13 |
|
13 | 14 | const currentCommit = __COMMIT__ |
14 | 15 | const activeVersion = ref(`@${currentCommit}`) |
15 | 16 | const publishedVersions = ref<string[]>() |
16 | 17 | const expanded = ref(false) |
17 | 18 |
|
| 19 | +const autoUrlRef = computed({ |
| 20 | + get: () => autoUrl, |
| 21 | + set: value => emit("update:autoUrl", value) |
| 22 | +}); |
| 23 | +
|
18 | 24 | async function toggle() { |
19 | 25 | expanded.value = !expanded.value |
20 | 26 | if (!publishedVersions.value) { |
@@ -91,6 +97,10 @@ async function fetchVersions(): Promise<string[]> { |
91 | 97 | <span>Vue SFC Playground</span> |
92 | 98 | </h1> |
93 | 99 | <div class="links"> |
| 100 | + <div class="url-generation"> |
| 101 | + <input type="checkbox" v-model="autoUrlRef" id="auto-url"> |
| 102 | + <label for="auto-url">Auto URL</label> |
| 103 | + </div> |
94 | 104 | <div class="version" @click.stop> |
95 | 105 | <span class="active-version" @click="toggle"> |
96 | 106 | Version: {{ activeVersion }} |
@@ -288,4 +298,15 @@ h1 img { |
288 | 298 | .github { |
289 | 299 | margin: 0 2px; |
290 | 300 | } |
| 301 | +
|
| 302 | +.url-generation { |
| 303 | + display: flex; |
| 304 | + flex-direction: row; |
| 305 | + margin: 0 2px; |
| 306 | + align-items: center; |
| 307 | + gap: 2px; |
| 308 | + border-right: 2px solid var(--border); |
| 309 | + padding: 5px; |
| 310 | + user-select: none; |
| 311 | +} |
291 | 312 | </style> |
0 commit comments