Commit 61420317 by liangzhen

暂存

1 parent 35d548fd
<template> <template>
<el-scrollbar ref="scrollContainer" :vertical="false" class="scroll-container" @wheel.native.prevent="handleScroll"> <el-scrollbar ref="scrollContainer" :vertical="false" class="scroll-container" @wheel.native.prevent="handleScroll">
<div :class="openBar?'icon':'iconLeft'" class="iconfont" @click="modifyStyle()">
&#xe644;
</div>
<slot /> <slot />
</el-scrollbar> </el-scrollbar>
</template> </template>
<script> <script>
import { EventBus } from "../event-bus.js";
const tagAndTagSpacing = 4 // tagAndTagSpacing const tagAndTagSpacing = 4 // tagAndTagSpacing
export default { export default {
name: 'ScrollPane', name: 'ScrollPane',
data() { data() {
return { return {
left: 0 left: 0,
openBar:true,
} }
}, },
computed: { computed: {
...@@ -20,6 +25,15 @@ export default { ...@@ -20,6 +25,15 @@ export default {
} }
}, },
methods: { methods: {
modifyStyle() {
this.openBar=!this.openBar
if(!this.openBar){
EventBus.$emit('modifyStyleEvent', 'new-style');
}else{
EventBus.$emit('modifyStyleEvent', 'old-style');
}
},
handleScroll(e) { handleScroll(e) {
const eventDelta = e.wheelDelta || -e.deltaY * 40 const eventDelta = e.wheelDelta || -e.deltaY * 40
const $scrollWrapper = this.scrollWrapper const $scrollWrapper = this.scrollWrapper
...@@ -72,7 +86,37 @@ export default { ...@@ -72,7 +86,37 @@ export default {
white-space: nowrap; white-space: nowrap;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
padding-left: 100px;
width: 100%; width: 100%;
.icon{
top:6px;
width: 48px;
height: 27px;
line-height: 27px;
text-align: center;
color: #edeaff;
background-color: #63a4a6;
border: 1px solid #edf0f6;
border-radius: 5px;
font-size: 24px;
position: absolute;
left: 0;
transform: rotate(180deg);
}
.iconLeft{
top:6px;
width: 48px;
height: 27px;
line-height: 27px;
text-align: center;
color: #edeaff;
background-color: #63a4a6;
border: 1px solid #edf0f6;
border-radius: 5px;
font-size: 24px;
position: absolute;
left: 0;
}
/deep/ { /deep/ {
.el-scrollbar__bar { .el-scrollbar__bar {
bottom: 0px; bottom: 0px;
...@@ -82,4 +126,13 @@ export default { ...@@ -82,4 +126,13 @@ export default {
} }
} }
} }
.fold-button{
// width:25px;
// height:20px;
// line-height: 28px;
// text-align: center;
// font-size: 14px;
// font-weight: 600;
}
</style> </style>
...@@ -235,6 +235,7 @@ export default { ...@@ -235,6 +235,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
@import '@/styles/common.scss'; @import '@/styles/common.scss';
/deep/ .scroll-container .el-scrollbar__wrap { /deep/ .scroll-container .el-scrollbar__wrap {
// padding-left: 50px;
scrollbar-width: none; scrollbar-width: none;
} }
.hamburger-container { .hamburger-container {
......
import Vue from 'vue'
export const EventBus = new Vue()
\ No newline at end of file
...@@ -40,6 +40,8 @@ export default { ...@@ -40,6 +40,8 @@ export default {
height: calc(100% - 55px); height: calc(100% - 55px);
position: relative; position: relative;
padding: 15px; padding: 15px;
display: flex;
flex-direction:column;
} }
</style> </style>
\ No newline at end of file
<template> <template>
<div class="layout"> <div class="layout">
<LeftBar class="bar" :authority="authority" :autho="autho" ref="child"></LeftBar> <LeftBar :class="openBar?'bar':'barClose'" :authority="authority" :autho="autho" ref="child"></LeftBar>
<ContinerView class="continer" id="myElement"> <ContinerView class="continer" id="myElement">
<router-view></router-view> <router-view></router-view>
</ContinerView> </ContinerView>
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
</template> </template>
<script> <script>
import { EventBus } from "../../components/event-bus.js";
import ContinerView from "./continerView"; import ContinerView from "./continerView";
import LeftBar from "./leftBar"; import LeftBar from "./leftBar";
...@@ -58,6 +59,7 @@ export default { ...@@ -58,6 +59,7 @@ export default {
}, },
data() { data() {
return { return {
openBar:true,
title: "确认更改", title: "确认更改",
submenu: [ submenu: [
{ {
...@@ -154,9 +156,16 @@ export default { ...@@ -154,9 +156,16 @@ export default {
}, },
mounted() { mounted() {
EventBus.$on('modifyStyleEvent', this.updateStyle)
}, },
methods: { methods: {
updateStyle(style) {
console.log('9999999')
this.openBar=!this.openBar
},
handleResize() { handleResize() {
// 处理窗口大小变化的逻辑 // 处理窗口大小变化的逻辑
console.log("Window was resized!"); console.log("Window was resized!");
...@@ -195,6 +204,9 @@ export default { ...@@ -195,6 +204,9 @@ export default {
} }
}, },
beforeDestroy() {
EventBus.$off('modifyStyleEvent', this.updateStyle);
},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -208,7 +220,12 @@ export default { ...@@ -208,7 +220,12 @@ export default {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
.bar { .bar {
width: 235px !important; width: 235px;
height: 100%;
flex-shrink: 0;
}
.barClose {
width: 0;
height: 100%; height: 100%;
flex-shrink: 0; flex-shrink: 0;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!