-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can we add a new function call collapse and expand panel on the left or on the right? #6
Comments
This would be great! |
@yimseknyCorarl @kevinelliott <template>
<div id="app">
<split-pane ref="example" :min-percent='20' :default-percent='50' split="vertical">
<template slot="paneL">
<div>Left</div>
</template>
<template slot="paneR">
<div>
<button @click="collapse" type="button">Toggle Collapse</button>
</div>
</template>
</split-pane>
</div>
</template>
<script>
export default {
name: 'App',
data () {
return {
isCollapsed: false
}
},
methods: {
collapse () {
if (this.isCollapsed) {
this.$refs.example.percent = 50;
this.isCollapsed = false;
} else {
this.$refs.example.percent = 0;
this.isCollapsed = true;
}
}
}
}
</script> |
Is there any way I could achieve the same effect through clicking on It'd be awesome if I wouldn't need to add another button just for this. Thanks in advance! |
@morph3us-net Without modifying the build itself you would have to add an event listener to the handles to invoke a vue function to modify the percent values. It would be less clean, but wouldn't require a new bundle. Though, it may be easier to pull the project and make an MR |
Thanks for the answer! Excuse me, but what is a MR? |
@morph3us-net One way, is to add in your mounted() function, an event listener on the pane divider. I haven't tested this, but something like...
|
And even better if you can remove the event listener when the component is destroyed 👯 |
Unfortunately, this does not work at all. I tried to make it print out a console log, but nothing happens. |
imagin that we wanna use panel for show full screen map, so we need to collapse panel on the left when click on fullscreen
The text was updated successfully, but these errors were encountered: