<van-tabbar v-model="active" @change="onChange"><van-tabbar-item icon="home-o">1</van-tabbar-item><van-tabbar-item icon="column">2</van-tabbar-item><van-tabbar-item icon="chat">3</van-tabbar-item><van-tabbar-item icon="manager">4</van-tabbar-item></van-tabbar>
import { ref, onMounted } from "vue";
import { useRouter } from "vue-router";const router = useRouter();let active = ref(0);
onMounted(() => {
console.log("router.currentRoute",router.currentRoute);active.value =router.currentRoute.value.path == "/userRecruit"? 0: router.currentRoute.value.path == "/jobFair"? 1: router.currentRoute.value.path == "/messageview"? 2: 3;
});function onChange(index) {if (index == 0) {router.replace("/");} else if (index == 1) {router.replace("/");} else if (index == 2) {router.replace("/");} else if (index == 3) {router.replace("/");}
}