Skip to content

Commit

Permalink
feat: RouterBar support clear preview
Browse files Browse the repository at this point in the history
  • Loading branch information
gene9831 committed Feb 11, 2025
1 parent fc0d40f commit 40d9e7c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/canvas/route-bar/src/CanvasRouteBar.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<div id="canvas-route-bar" :style="sizeStyle">
<div class="address-bar">
<template v-for="(route, index) in routes" :key="route.id">
<span v-if="index > 0" class="slash">/</span>
<template v-for="route in routes" :key="route.id">
<span class="slash">/</span>
<span
:class="[
{ route: route.isPage && route.id !== pageId, current: route.id === pageId, 'is-preview': route.isPreview }
Expand Down Expand Up @@ -31,8 +31,9 @@ const sizeStyle = computed(() => {
const { pageSettingState, getAncestors, switchPageWithConfirm } = usePage()
const pageId = ref(getMetaApi(META_SERVICE.GlobalService).getBaseInfo().pageId)
const previewId = ref(getMetaApi(META_SERVICE.GlobalService).getBaseInfo().previewId)
const baseInfo = getMetaApi(META_SERVICE.GlobalService).getBaseInfo()
const pageId = ref(baseInfo.pageId)
const previewId = ref(baseInfo.previewId)
const existsPreview = ref(false)
const { subscribe, unsubscribe } = useMessage()
Expand Down Expand Up @@ -124,7 +125,7 @@ const handleClickRoute = (route) => {
}
const handleClearPreview = () => {
// TODO
getMetaApi(META_SERVICE.GlobalService).updatePreviewId('')
}
</script>

Expand Down Expand Up @@ -160,7 +161,7 @@ const handleClearPreview = () => {
}
}
.slash {
margin: 0 4px;
margin: 0 2px;
}
.current {
font-weight: bold;
Expand Down

0 comments on commit 40d9e7c

Please sign in to comment.