mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
fix(iframe-drawer): cannot change url when video changes (#1072)
* fix: 抽屉页面内点击其他链接跳转后,“在新标签页打开“按钮无法正确导向至当前链接 #1068 * chore: update * chore: update --------- Co-authored-by: Hakadao <a578457889743@gmail.com>
This commit is contained in:
@@ -192,20 +192,20 @@ async function haveScrollbar() {
|
||||
return scrollHeight > window.innerHeight
|
||||
}
|
||||
|
||||
// When opening a video in drawer mode, listen for changes to the drawer's inner iframe url.
|
||||
// When the iframe's url changes, update the parent url to match the iframe's url.
|
||||
const beforeUrl = ref<string>(location.href.replace(/\/$/, ''))
|
||||
if (inIframe.value) {
|
||||
useEventListener(window, 'pushstate', handleIframeUrlChange)
|
||||
useEventListener(window, 'click', handleIframeUrlChange)
|
||||
// // When opening a video in drawer mode, listen for changes to the drawer's inner iframe url.
|
||||
// // When the iframe's url changes, update the parent url to match the iframe's url.
|
||||
// const beforeUrl = ref<string>(location.href.replace(/\/$/, ''))
|
||||
// if (inIframe.value) {
|
||||
// // useEventListener(window, 'pushstate', handleIframeUrlChange)
|
||||
// useEventListener(window, 'click', handleIframeUrlChange)
|
||||
|
||||
function handleIframeUrlChange() {
|
||||
if (beforeUrl.value.replace(/\/$/, '') !== parent.location.href.replace(/\/$/, '')) {
|
||||
parent.history.pushState(null, '', location.href.replace(/\/$/, ''))
|
||||
}
|
||||
beforeUrl.value = location.href.replace(/\/$/, '')
|
||||
}
|
||||
}
|
||||
// function handleIframeUrlChange() {
|
||||
// if (beforeUrl.value.replace(/\/$/, '') !== parent.location.href.replace(/\/$/, '')) {
|
||||
// parent.history.pushState(null, '', location.href.replace(/\/$/, ''))
|
||||
// }
|
||||
// beforeUrl.value = location.href.replace(/\/$/, '')
|
||||
// }
|
||||
// }
|
||||
|
||||
provide<BewlyAppProvider>('BEWLY_APP', {
|
||||
activatedPage,
|
||||
|
||||
Reference in New Issue
Block a user