uni-menu-group.vue 798 字节
Newer Older
M
MicroMilo 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
<template>
	<view class="uni-menu-group">
		<view class="uni-menu-group__title" name="title" :style="{paddingLeft:paddingLeft}">{{title}}</view>
		<slot></slot>
	</view>
</template>

<script>
	import rootParent from '../uni-nav-menu/mixins/rootParent.js'
	export default {
		name: 'uniMenuGroup',
		mixins:[rootParent],
		props: {
			title: String
		},
		data() {
			return {

			};
		},
		computed: {
			paddingLeft() {
				return 20+20 * this.rootMenu.SubMenu.length + 'px'
			}
		},
		created() {
			this.init()
		},
		methods: {
			init() {
				this.rootMenu = {
					SubMenu: []
				}
				this.getParentAll('SubMenu', this)
			}
		}
	}
</script>

<style>
.uni-menu-group {
	/* border: 1px red solid; */
}
.uni-menu-group__title {
	line-height: 36px;
	font-size: 12px;
	color: #999;
}
</style>