You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.4 KiB

5 years ago
3 years ago
5 years ago
3 years ago
5 years ago
3 years ago
5 years ago
  1. <template>
  2. <div class="app-wrapper" :class="{hideSidebar:!sidebar.opened}">
  3. <sidebar class="sidebar-container"></sidebar>
  4. <div class="main-container">
  5. <navbar></navbar>
  6. <tags-view></tags-view>
  7. <app-main ref="main" :style="{overflowY:'auto',maxHeight:maxHeight?maxHeight+'px':'90vh'}"></app-main>
  8. </div>
  9. </div>
  10. </template>
  11. <script>
  12. import { Navbar, Sidebar, AppMain, TagsView } from './components'
  13. export default {
  14. name: 'layout',
  15. components: {
  16. Navbar,
  17. Sidebar,
  18. AppMain,
  19. TagsView
  20. },
  21. data(){
  22. return {
  23. maxHeight:null,
  24. }
  25. },
  26. methods:{
  27. calcMaxHeight(cssSelector) {
  28. var table=cssSelector;
  29. debugger;
  30. if(typeof cssSelector == 'string'){
  31. table=document.querySelector(cssSelector);
  32. }
  33. var innerHeight=window.innerHeight
  34. var top=150;
  35. if(table!=null){
  36. var rect=table.getBoundingClientRect()
  37. if(rect && rect.top!=0){
  38. top=rect.top;
  39. }
  40. }
  41. var maxTableHeight =innerHeight-top;
  42. return maxTableHeight;
  43. },
  44. },
  45. computed: {
  46. sidebar() {
  47. return this.$store.state.app.sidebar
  48. }
  49. },
  50. mounted(){
  51. this.maxHeight=this.calcMaxHeight(this.$refs.main.$el)
  52. }
  53. }
  54. </script>
  55. <style rel="stylesheet/scss" lang="scss" scoped>
  56. @import "src/styles/mixin.scss";
  57. .app-wrapper {
  58. @include clearfix;
  59. position: relative;
  60. height: 100%;
  61. width: 100%;
  62. }
  63. </style>