Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

Commit

Permalink
fix: the issue that the sidebar retracts unsuccessfully in some browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
elonehoo committed Dec 7, 2023
1 parent a9b9682 commit 0da1917
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 32 deletions.
15 changes: 5 additions & 10 deletions components/sidebar/Sidebar.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
<script setup lang="ts">
const sidebar = useSidebarStore()
watch(() => sidebar.show, () => {
if (sidebar.show)
sidebar.handleCreateSize()
else
sidebar.handleClearSize()
})
const { panSize, show } = storeToRefs(sidebar)
</script>

<template>
<SplitpanesPane
v-if="show"
class="bg-light-50 dark:bg-#050505 border-r border-gray-400/20"
:size="sidebar.panSize.size"
:min-size="sidebar.panSize.minSize"
:max-size="sidebar.panSize.maxSize"
:size="panSize.size"
:min-size="panSize.minSize"
:max-size="panSize.maxSize"
>
<nav class="flex flex-col" livraison-app="sideabr">
<SidebarIconAction />
Expand Down
22 changes: 0 additions & 22 deletions store/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,12 @@ export const useSidebarStore = defineStore('sidebar', () => {
show.value = !show.value
}

function handleMoveSize() {
size.value = panSize.value.size
}

function handleClearSize() {
handleMoveSize()
panSize.value = {
minSize: 0,
size: 0,
maxSize: 0,
}
}

Check failure on line 22 in store/sidebar.ts

View workflow job for this annotation

GitHub Actions / lint

More than 1 blank line not allowed
function handleCreateSize() {
panSize.value = {
minSize: 15,
size: size.value,
maxSize: 30,
}
}
return {
size,
show,
panSize,
handleMoveSize,
handleToggleSidebar,
handleClearSize,
handleCreateSize,
}
}, {
persist: true,
Expand Down

0 comments on commit 0da1917

Please sign in to comment.