]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore(sfc-playground): highlight the active version in dropdown (#9045)
authorbtea <2356281422@qq.com>
Mon, 11 Dec 2023 10:47:06 +0000 (18:47 +0800)
committerGitHub <noreply@github.com>
Mon, 11 Dec 2023 10:47:06 +0000 (18:47 +0800)
packages/sfc-playground/src/Header.vue
packages/sfc-playground/src/VersionSelect.vue

index e865a76a5fed740dbe9503f3ea477401500c7db8..cf8ea9013fea79923c33c1d9109b8d529c4f3fdf 100644 (file)
@@ -24,7 +24,7 @@ const vueVersion = ref(`@${currentCommit}`)
 async function setVueVersion(v: string) {
   vueVersion.value = `loading...`
   await store.setVueVersion(v)
-  vueVersion.value = `v${v}`
+  vueVersion.value = v
 }
 
 function resetVueVersion() {
index 2dfbcbc5f9199be3f10df72e7604ebde8a7a3df9..0c4a37138e5fa718606850852ce3ba5f31822c35 100644 (file)
@@ -74,8 +74,8 @@ onMounted(() => {
 
     <ul class="versions" :class="{ expanded }">
       <li v-if="!versions"><a>loading versions...</a></li>
-      <li v-for="version of versions">
-        <a @click="setVersion(version)">v{{ version }}</a>
+      <li v-for="ver of versions" :class="{ active: ver === version }">
+        <a @click="setVersion(ver)">v{{ ver }}</a>
       </li>
       <div @click="expanded = false">
         <slot />
@@ -111,4 +111,8 @@ onMounted(() => {
   border-top: 6px solid #aaa;
   margin-left: 8px;
 }
+
+.versions .active a {
+  color: var(--green);
+}
 </style>