split-pane.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <div class="components-container">
  3. <aside><strong>SplitPane</strong> If you've used
  4. <a href="https://codepen.io/" target="_blank"> codepen</a>,
  5. <a href="https://jsfiddle.net/" target="_blank"> jsfiddle </a>will not be unfamiliar.
  6. <a href="https://github.com/PanJiaChen/vue-split-pane" target="_blank"> Github repository</a>
  7. </aside>
  8. <split-pane split="vertical" @resize="resize">
  9. <template slot="paneL">
  10. <div class="left-container" />
  11. </template>
  12. <template slot="paneR">
  13. <split-pane split="horizontal">
  14. <template slot="paneL">
  15. <div class="top-container" />
  16. </template>
  17. <template slot="paneR">
  18. <div class="bottom-container" />
  19. </template>
  20. </split-pane>
  21. </template>
  22. </split-pane>
  23. </div>
  24. </template>
  25. <script>
  26. import splitPane from 'vue-splitpane'
  27. export default {
  28. name: 'SplitpaneDemo',
  29. components: { splitPane },
  30. methods: {
  31. resize() {
  32. console.log('resize')
  33. }
  34. }
  35. }
  36. </script>
  37. <style scoped>
  38. .components-container {
  39. position: relative;
  40. height: 100vh;
  41. }
  42. .left-container {
  43. background-color: #F38181;
  44. height: 100%;
  45. }
  46. .right-container {
  47. background-color: #FCE38A;
  48. height: 200px;
  49. }
  50. .top-container {
  51. background-color: #FCE38A;
  52. width: 100%;
  53. height: 100%;
  54. }
  55. .bottom-container {
  56. width: 100%;
  57. background-color: #95E1D3;
  58. height: 100%;
  59. }
  60. </style>