下面是浏览器有用,真机没用的;
import { getCurrentInstance ,computed} from 'vue';
const {proxy} = getCurrentInstance();
const router = computed(()=> proxy.$router.currentRoute.value.fullpath)
const metaName = computed(()=> proxy.$router.currentRoute.value..meta.navigationBar.titleText)
import { useRouter } from "vue-router"
const route = useRouter()
下面是真机,好使,有用;
onMounted(()=>{
const pagea = getCurrentPages();
router.value = pagea[pagea.length-1].route;
metaName.value = pagea[pagea.length-1].$page.meta.navigationBar.titleText;
console.log(router.value ,metaName.value );
})