leftWindow.vue 1.7 KB
Newer Older
VK1688's avatar
初始  
VK1688 已提交
1
<template>
VK1688's avatar
1.8.1  
VK1688 已提交
2 3 4 5 6 7
	<scroll-view class="sidebar" :class="vk.getVuex('$app.isPC') ? 'pc' : 'mobile'" scroll-y="true" v-loading="!vk.getVuex('$app.inited')"
	 :style="{
			backgroundColor:backgroundColor,
			boxShadow:boxShadow
	 }"
	>
VK1688's avatar
1.8.0  
VK1688 已提交
8 9
		<vk-data-menu-nav
			v-if="vk.getVuex('$app.inited')"
VK1688's avatar
初始  
VK1688 已提交
10 11
			:data="vk.getVuex('$app.navMenu')"
			:uniqueOpened="true"
VK1688's avatar
1.8.0  
VK1688 已提交
12
			:theme="theme"
VK1688's avatar
初始  
VK1688 已提交
13 14 15 16 17 18
			@select="select"
		></vk-data-menu-nav>
	</scroll-view>
</template>

<script>
VK1688's avatar
1.8.0  
VK1688 已提交
19
	import config from "@/app.config.js";
VK1688's avatar
初始  
VK1688 已提交
20 21 22
	export default {
		data() {
			return {
VK1688's avatar
1.8.0  
VK1688 已提交
23
				theme: config.theme
VK1688's avatar
初始  
VK1688 已提交
24 25 26 27
			}
		},
		methods: {
			select(e){
VK1688's avatar
1.8.0  
VK1688 已提交
28

VK1688's avatar
初始  
VK1688 已提交
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
			},
		},
		// 监听属性
		watch: {
			$route: {
				immediate: true,
				handler(newRoute, oldRoute) {
					let that = this;
					let { vk } = that;
					let { path , query } = newRoute;
					let url = path + vk.pubfn.queryParams(query);
					let route = { path, query, url };
					vk.setVuex('$app.route', route);
				}
			}
		},
		// 计算属性
		computed: {
VK1688's avatar
1.8.0  
VK1688 已提交
47 48 49 50 51 52 53
			backgroundColor(){
				let theme = this.theme;
				if (theme && theme.use) {
					return theme[theme.use].leftMenu.backgroundColor;
				} else {
					return "#ffffff";
				}
VK1688's avatar
1.8.1  
VK1688 已提交
54 55 56 57 58 59 60 61
			},
			boxShadow(){
				let theme = this.theme;
				if (theme && theme.use) {
					return theme[theme.use].leftMenu.boxShadow;
				} else {
					return "2px 0 6px rgba(0,21,4,0.2)";
				}
VK1688's avatar
1.8.0  
VK1688 已提交
62 63
			}
		}
VK1688's avatar
初始  
VK1688 已提交
64 65 66 67 68 69 70 71 72 73
	}
</script>

<style lang="scss">
	.sidebar {
		position: fixed;
		top: var(--window-top);
		width: 240px;
		height: calc(100vh - (var(--window-top)) + 50px);
		box-sizing: border-box;
VK1688's avatar
1.8.1  
VK1688 已提交
74 75
		box-shadow: var(--boxShadow);
		box-shadow: 2px 0 8px 0 rgba(29,35,41,0.05);
VK1688's avatar
初始  
VK1688 已提交
76 77 78 79 80 81 82 83 84 85 86 87 88
		background-color: $left-window-bg-color;
		padding-bottom: 10px;
		top: 50px;
		z-index: 998;
	}
	.title {
		margin-left: 5px;
	}
	.center{
		text-align: center;
		margin-top: 100px;
	}
</style>