Showing
4 changed files
with
114 additions
and
1 deletions
code/apps/report/client/Charts/app1.vue
0 → 100644
code/components/multilevel/drop-arrow.png
0 → 100644

314 Bytes
code/components/multilevel/index.vue
0 → 100644
1 | +<style> | ||
2 | + .multilevel{position: relative; font-family: 'microsoft yahei'; font-size:14px; color: #585858} | ||
3 | + .multilevel a,.multilevel span{cursor: pointer; text-decoration: none; color:#585858} | ||
4 | + | ||
5 | + .picker-data{display: inline-block; width: 250px; height: 34px; border: 1px solid #ccd0d4; padding:6px 12px; position: relative; border-radius: 3px} | ||
6 | + .placeholder{display: block} | ||
7 | + .select-item a:hover{background: #CCCCCC} | ||
8 | + .select-item i{margin: 0 2px} | ||
9 | + .arrow{position: absolute; top: 50%; right: 8px; width: 10px; margin-top: -3px; height: 5px; background: url(./drop-arrow.png) -10px -25px no-repeat} | ||
10 | + | ||
11 | + .picker-dropdown{position: absolute; top: 34px; left: 1px;} | ||
12 | + .select-wrap{box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5); border-radius: 4px; width: 300px} | ||
13 | + | ||
14 | + .select-tab{background: #f0f0f0; border-bottom: 1px solid #ccc;} | ||
15 | + .select-tab a{display: inline-block; padding: 8px 15px; border-left: 1px solid #ccc; border-bottom: 1px solid transparent; margin-bottom: -1px} | ||
16 | + .select-tab a:first-child { border-left: none} | ||
17 | + .select-tab a.active{background: #FFFFFF; border-bottom: 1px solid #FFFFFF;} | ||
18 | + | ||
19 | + .select-content{background: #FFFFFF;} | ||
20 | + .levelContent{clear: both; list-style: none; margin: 0; padding: 10px;} | ||
21 | + .levelContent li{display: inline-block; padding: 5px 10px;} | ||
22 | +</style> | ||
23 | + | ||
24 | +<template> | ||
25 | + <div class="multilevel"> | ||
26 | + <span class="picker-data"> | ||
27 | + <span v-show="dataList.length==0" class="placeholder" @click="showDropdown">请选择类目</span> | ||
28 | + <span v-show="dataList.length>0" class="data"> | ||
29 | + <span class="select-item" v-for="data in dataList"> | ||
30 | + <i v-if="$index>0">/</i> | ||
31 | + <a href="javascript:" @click="selectTab($index)">{{data}}</a> | ||
32 | + </span> | ||
33 | + </span> | ||
34 | + <div class="arrow"></div> | ||
35 | + </span> | ||
36 | + | ||
37 | + <div class="picker-dropdown" v-show="isShowDropdown"> | ||
38 | + <div class="select-wrap"> | ||
39 | + <div class="select-tab"> | ||
40 | + <a v-for="tab in levelContent" class="level {{$index==activeTab?'active':''}}" @click="selectTab($index)">{{tab.name}}</a> | ||
41 | + </div> | ||
42 | + <div class="select-content"> | ||
43 | + <ul v-for="content in levelContent" class="levelContent" v-show="activeTab==$index"> | ||
44 | + <li v-for="item in content.list"><a href="javascript:" @click="selectItem(item)">{{item}}</a></li> | ||
45 | + </ul> | ||
46 | + </div> | ||
47 | + </div> | ||
48 | + </div> | ||
49 | + </div> | ||
50 | +</template> | ||
51 | + | ||
52 | +<script> | ||
53 | + export default { | ||
54 | + data() { | ||
55 | + return { | ||
56 | + levelContent:[ | ||
57 | + {name:"一级目录", list:["a1","a2","a3"]}, | ||
58 | + {name:"二级目录", list:["b1","b2","b3"]}, | ||
59 | + {name:"三级目录", list:["c1","c2","c3"]} | ||
60 | + ], | ||
61 | + isShowDropdown:false, | ||
62 | + activeTab:0, | ||
63 | + maxTab:2, | ||
64 | + dataList:[] | ||
65 | + } | ||
66 | + }, | ||
67 | + computed:{ | ||
68 | + dataArray(){ | ||
69 | + console.log(this.dataList); | ||
70 | + return this.dataList.join('/'); | ||
71 | + } | ||
72 | + }, | ||
73 | + methods: { | ||
74 | + showDropdown(){ | ||
75 | + if(this.isShowDropdown){ | ||
76 | + this.isShowDropdown = false; | ||
77 | + }else{ | ||
78 | + this.isShowDropdown = true; | ||
79 | + } | ||
80 | + }, | ||
81 | + | ||
82 | + selectTab(index){ | ||
83 | + this.isShowDropdown = true; | ||
84 | + this.activeTab = index; | ||
85 | + }, | ||
86 | + | ||
87 | + selectItem(item){ | ||
88 | + this.dataList.$set(this.activeTab,item); | ||
89 | + this.dataList.splice(this.activeTab+1, this.dataList.length-this.activeTab-1); | ||
90 | + | ||
91 | + if(this.activeTab < this.maxTab){ | ||
92 | + this.activeTab ++; | ||
93 | + }else{ | ||
94 | + this.activeTab = 0; | ||
95 | + this.isShowDropdown = false; | ||
96 | + } | ||
97 | + } | ||
98 | + } | ||
99 | + } | ||
100 | +</script> |
-
Please register or login to post a comment