Skip to content

Commit

Permalink
chore: try use window location
Browse files Browse the repository at this point in the history
  • Loading branch information
sonofmagic committed Jul 15, 2024
1 parent b04e6a9 commit 3155dbd
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
1 change: 1 addition & 0 deletions apps/shell-vue-app/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ onBeforeUnmount(() => {
v-for="app in apps" v-show="app.visible" :key="app.name" width="100%" height="100%" :name="app.name"
:url="app.url" :sync="true" :beforeLoad="beforeLoad" :beforeMount="beforeMount" :afterMount="afterMount"
:beforeUnmount="beforeUnmount" :afterUnmount="afterUnmount"
:alive="true"
/>
</div>
</div>
Expand Down
16 changes: 15 additions & 1 deletion apps/vue-app/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
<script setup lang="ts">
const subAppLocation = window.__POWERED_BY_WUJIE__ ? window.$wujie.location : window.location
if (window.__WUJIE?.degrade || !window.Proxy || !window.CustomElementRegistry) {
window.$wujie.location.href = 'https://v2.vuejs.org/'
}
else {
window.location.href = 'https://wujicode.cn/xy/app/prod/official/index'
}
function setHref(href: string) {
window.location.href = href
if (window.__WUJIE?.degrade || !window.Proxy || !window.CustomElementRegistry) {
window.$wujie.location.href = 'https://v2.vuejs.org/'
}
else {
window.location.href = 'https://wujicode.cn/xy/app/prod/official/index'
}
}
</script>

Expand Down
10 changes: 9 additions & 1 deletion apps/vue2-app/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<script setup lang="ts">
import { subAppLocation } from './router'
function setHref(href: string) {
window.location.href = href
// subAppLocation.href = href
console.log(subAppLocation)
console.log(window.$wujie.location.href)
// window.$wujie.location.href = href
window.$wujie.location.href = href
console.log(window.$wujie.location.href)
// window.location.href = href
}
</script>

Expand Down
2 changes: 2 additions & 0 deletions apps/vue2-app/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ export const routes: RouteConfig[] = [
]

Vue.use(VueRouter)

export const subAppLocation = window.__POWERED_BY_WUJIE__ ? window.$wujie.location : window.location

0 comments on commit 3155dbd

Please sign in to comment.