|
@@ -49,10 +49,20 @@ const route = useRoute()
|
|
|
const router = useRouter()
|
|
const router = useRouter()
|
|
|
|
|
|
|
|
|
|
|
|
|
-const activeIndex = ref('1')
|
|
|
|
|
function goMyLearning() {
|
|
function goMyLearning() {
|
|
|
router.push('/my-learning')
|
|
router.push('/my-learning')
|
|
|
}
|
|
}
|
|
|
|
|
+// 将 activeIndex 改为响应式,并根据当前路由动态计算
|
|
|
|
|
+const activeIndex = computed(() => {
|
|
|
|
|
+ switch (route.path) {
|
|
|
|
|
+ case '/':
|
|
|
|
|
+ return '1'
|
|
|
|
|
+ case '/my-learning':
|
|
|
|
|
+ return '2'
|
|
|
|
|
+ default:
|
|
|
|
|
+ return '1' // 默认返回首页
|
|
|
|
|
+ }
|
|
|
|
|
+})
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
<style lang="scss">
|