m-dropdown.vue 1.12 KB
<template>
	<div>
		<div class="panel" :class="{'hide':!visible}">
			<div class="list">
				<div v-for="(item,index) in navList" :key="item.id" :index="index">
					<van-collapse @change="onChangeHandler" v-model="activeNames[index]" v-if="item && item.list && item.list.length > 0">
						<van-collapse-item :border="borderBoo" :title="item.name" :name="index">
							<div slot="title">
								<span :class="{'coll-item-act':index == activeIndex}" >{{item.name}}</span>
							</div>
							<div slot="right-icon">
								<div class="icon-wrap"> 
									<div class="plus-icon" :class="{'plus-icon-act':index == activeIndex}"></div>
								</div>
							</div>
							<div @click="onClickHandler(item)" class="list-item"  v-for="item2 in item.list" :key="item2.id">
								<div class="arrow-icon"></div> {{ item2.name }}
							</div>
						</van-collapse-item>
					</van-collapse>
					<div v-else @click="onClickHandler(item)" class="list-item">
						{{item.name}}
					</div>
				</div>
			</div>
		</div>
	</div>
</template>

<script src="./m-dropdown.js"></script>
<style lang="scss" scoped>
@import "./m-dropdown.scss";
</style>