mirror of
https://github.com/VueTubeApp/VueTube
synced 2025-01-06 23:51:13 +00:00
fix: in app-browser of description links
This commit is contained in:
parent
3030101069
commit
88aa853b95
1 changed files with 32 additions and 3 deletions
|
@ -1,8 +1,19 @@
|
|||
<template>
|
||||
<div class="description" style="white-space: pre-line">
|
||||
<template v-for="(text, index) in render.description.runs">
|
||||
<template v-if="text.navigationEndpoint">
|
||||
<a :href="parseLinks(text)" :key="index">{{ text.text }}</a>
|
||||
<template
|
||||
v-if="
|
||||
text.navigationEndpoint && text.navigationEndpoint.webviewEndpoint
|
||||
"
|
||||
>
|
||||
<a @click="openExternal(parseLinks(text))" :key="index" class="link">{{
|
||||
text.text
|
||||
}}</a>
|
||||
</template>
|
||||
<template v-else-if="checkInternal(text)">
|
||||
<a @click="openInternal(parseLinks(text))" :key="index" class="link">{{
|
||||
text.text
|
||||
}}</a>
|
||||
</template>
|
||||
<template v-else> {{ text.text }} </template>
|
||||
</template>
|
||||
|
@ -12,6 +23,7 @@
|
|||
<style scoped></style>
|
||||
|
||||
<script>
|
||||
import { Browser } from "@capacitor/browser";
|
||||
export default {
|
||||
props: ["render"],
|
||||
|
||||
|
@ -20,13 +32,30 @@ export default {
|
|||
const navEndpoint = base.navigationEndpoint;
|
||||
if (!navEndpoint) return;
|
||||
if (navEndpoint.webviewEndpoint) {
|
||||
return base.text;
|
||||
return navEndpoint.webviewEndpoint.url;
|
||||
} else if (navEndpoint.browseEndpoint) {
|
||||
return navEndpoint.browseEndpoint.canonicalBaseUrl;
|
||||
} else if (navEndpoint.watchEndpoint) {
|
||||
return `/watch?v=${navEndpoint.watchEndpoint.videoId}`;
|
||||
} else if (navEndpoint.navigationEndpoint) {
|
||||
return; //for now
|
||||
}
|
||||
},
|
||||
checkInternal(base) {
|
||||
const navEndpoint = base.navigationEndpoint;
|
||||
if (!navEndpoint) return false;
|
||||
if (navEndpoint.browseEndpoint || navEndpoint.watchEndpoint) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
async openExternal(url) {
|
||||
await Browser.open({ url: url });
|
||||
},
|
||||
async openInternal(url) {
|
||||
await this.$router.push(url);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue