Skip to content

Commit 19ed153

Browse files
committed
feat: save split pane position in local storage
1 parent 41610e1 commit 19ed153

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/SplitPane.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ const container = ref()
1111
const store = inject('store') as Store
1212
const showOutput = ref(store.initialShowOutput)
1313
14+
const savedSplit = parseFloat(localStorage.getItem('vue-repl:split') ?? '')
15+
1416
const state = reactive({
1517
dragging: false,
16-
split: 50
18+
split: !isNaN(savedSplit) ? savedSplit : 50,
1719
})
1820
1921
const boundSplit = computed(()=>{
@@ -43,6 +45,8 @@ function dragMove(e: MouseEvent) {
4345
4446
function dragEnd() {
4547
state.dragging = false
48+
49+
localStorage.setItem('vue-repl:split', state.split.toString())
4650
}
4751
</script>
4852

0 commit comments

Comments
 (0)