Commit cbaf4e236132e86f620f71ea53666a0f74e98006

Authored by 梁灏
1 parent 5d6bf568

update Menu style

Showing 2 changed files with 53 additions and 208 deletions   Show diff stats
examples/routers/menu.vue
1 1 <template>
2   - <div>
3   - <Menu ref="menu" active-name="1-2" :open-names="openNames" theme="light" accordion @on-open-change="handleOpenChange">
4   - <Submenu name="1">
5   - <template slot="title">
6   - <Icon type="ios-analytics"></Icon>
7   - Navigation One
8   - </template>
9   - <MenuGroup title="Item 1">
10   - <MenuItem name="1-1">Option 1</MenuItem>
11   - <MenuItem name="1-2">Option 2</MenuItem>
12   - </MenuGroup>
13   - <MenuGroup title="Item 2">
14   - <MenuItem name="1-3">Option 3</MenuItem>
15   - <MenuItem name="1-4">Option 4</MenuItem>
16   - </MenuGroup>
17   - </Submenu>
18   - <Submenu name="2">
19   - <template slot="title">
20   - <Icon type="ios-filing"></Icon>
21   - Navigation Two
22   - </template>
23   - <MenuItem name="2-1" to="/button">Option 5</MenuItem>
24   - <MenuItem name="2-2" to="//iviewui.com" target="_blank">Option 6</MenuItem>
25   - <Submenu name="3">
26   - <template slot="title">Submenu</template>
27   - <MenuItem name="3-1">Option 7</MenuItem>
28   - <MenuItem name="3-2">Option 8</MenuItem>
29   - </Submenu>
30   - <Submenu name="4">
31   - <template slot="title">Submenu</template>
32   - <MenuItem name="4-1">Option 7</MenuItem>
33   - <MenuItem name="4-2">Option 8</MenuItem>
34   - </Submenu>
35   - </Submenu>
36   - <Submenu name="5">
37   - <template slot="title">
38   - <Icon type="ios-gear"></Icon>
39   - Navigation Three
40   - </template>
41   - <MenuItem name="5-1">Option 9</MenuItem>
42   - <MenuItem name="5-2">Option 10</MenuItem>
43   - <MenuItem name="5-3">Option 11</MenuItem>
44   - <MenuItem name="5-4">Option 12</MenuItem>
45   - </Submenu>
46   - </Menu>
47   - <br/>
48   - <Menu ref="menu2" theme="dark" accordion :open-names="openNames2" @on-open-change="handleOpenChange">
49   - <template v-for="item in menuList">
50   - <custem-menu-item v-if="item.children" :key="`menu-${item.name}`" :parent-item="item"></custem-menu-item>
51   - <menu-item v-else :name="`${item.name}`" :key="`menu-${item.name}`">{{ item.name }}</menu-item>
  2 + <Menu active-name="1-2" :open-names="['1']">
  3 + <Submenu name="1">
  4 + <template slot="title">
  5 + <Icon type="ios-analytics"></Icon>
  6 + Navigation One
52 7 </template>
53   - </Menu>
54   - <Button @click="addNewItem">添加菜单项</Button>
55   - <Button @click="changeActive">修改激活项</Button>
56   - <Button @click="setOpenNames">修改展开数组</Button>
57   - <Menu mode="horizontal" theme="light" :active-name="activeName" @on-open-change="hc">
58   - <MenuItem name="1">
59   - <Icon type="ios-paper"></Icon>
60   - 内容管理
61   - </MenuItem>
62   - <MenuItem name="2">
63   - <Icon type="ios-people"></Icon>
64   - 用户管理
65   - </MenuItem>
  8 + <MenuGroup title="Item 1">
  9 + <MenuItem name="1-1">我是菜单一</MenuItem>
  10 + <MenuItem name="1-2">我是菜单二</MenuItem>
  11 + </MenuGroup>
  12 + <MenuGroup title="Item 2">
  13 + <MenuItem name="1-3">我是菜单三</MenuItem>
  14 + <MenuItem name="1-4">我是菜单四</MenuItem>
  15 + </MenuGroup>
  16 + </Submenu>
  17 + <Submenu name="2">
  18 + <template slot="title">
  19 + <Icon type="ios-filing"></Icon>
  20 + Navigation Two
  21 + </template>
  22 + <MenuItem name="2-1">我是菜单五</MenuItem>
  23 + <MenuItem name="2-2">我是菜单六</MenuItem>
66 24 <Submenu name="3">
67   - <template slot="title">
68   - <Icon type="stats-bars"></Icon>
69   - 统计分析
70   - </template>
71   - <MenuGroup title="使用">
72   - <MenuItem name="3-1">新增和启动</MenuItem>
73   - <MenuItem name="3-2">活跃分析</MenuItem>
74   - <MenuItem name="3-3">时段分析</MenuItem>
75   - </MenuGroup>
76   - <MenuGroup title="留存">
77   - <MenuItem name="3-4">用户留存</MenuItem>
78   - <MenuItem name="3-5">流失用户</MenuItem>
79   - </MenuGroup>
80   - </Submenu>
81   - <Submenu name="4">
82   - <template slot="title">
83   - <Icon type="stats-bars"></Icon>
84   - 统计分析2
85   - </template>
86   - <MenuGroup title="使用2">
87   - <MenuItem name="4-1">新增和启动2</MenuItem>
88   - <MenuItem name="4-2">活跃分析2</MenuItem>
89   - <MenuItem name="4-3">时段分析2</MenuItem>
90   - </MenuGroup>
91   - <MenuGroup title="留存2">
92   - <MenuItem name="4-4">用户留存2</MenuItem>
93   - <MenuItem name="4-5">流失用户2</MenuItem>
94   - </MenuGroup>
  25 + <template slot="title">Submenu</template>
  26 + <MenuItem name="3-1">我是菜单七</MenuItem>
  27 + <MenuItem name="3-2">我是菜单八</MenuItem>
95 28 </Submenu>
96   - <MenuItem name="5">
97   - <Icon type="settings"></Icon>
98   - 综合设置
99   - </MenuItem>
100   - </Menu>
101   - </div>
  29 + </Submenu>
  30 + <Submenu name="4">
  31 + <template slot="title">
  32 + <Icon type="ios-gear"></Icon>
  33 + Navigation Three
  34 + </template>
  35 + <MenuItem name="4-1">Option 9</MenuItem>
  36 + <MenuItem name="4-2">Option 10</MenuItem>
  37 + <MenuItem name="4-3">Option 11</MenuItem>
  38 + <MenuItem name="4-4">Option 12</MenuItem>
  39 + </Submenu>
  40 + </Menu>
102 41 </template>
103 42 <script>
104   -import custemMenuItem from './custem-menu-item.vue'
105 43 export default {
106   - components: {
107   - custemMenuItem
108   - },
109   - data () {
110   - return {
111   - openNames: ['1'],
112   - openNames2: [],
113   - menuList: [
114   - {
115   - name: '111',
116   - children: [
117   - {
118   - name: '111-111'
119   - },
120   - {
121   - name: '111-222'
122   - }
123   - ]
124   - },
125   - {
126   - name: '222',
127   - children: [
128   - {
129   - name: '222-111'
130   - },
131   - {
132   - name: '222-222',
133   - children: [
134   - {
135   - name: '222-222-111'
136   - },
137   - {
138   - name: '222-222-222',
139   - children: [
140   - {
141   - name: '222-222-222-111'
142   - },
143   - {
144   - name: '222-222-222-222'
145   - }
146   - ]
147   - }
148   - ]
149   - },
150   - {
151   - name: '222-333',
152   - children: [
153   - {
154   - name: '222-333-111',
155   - children: [
156   - {
157   - name: '222-333-111-111'
158   - },
159   - {
160   - name: '222-333-111-222'
161   - }
162   - ]
163   - },
164   - {
165   - name: '222-333-222',
166   - children: [
167   - {
168   - name: '222-333-222-111'
169   - },
170   - {
171   - name: '222-333-222-222'
172   - }
173   - ]
174   - }
175   - ]
176   - }
177   - ]
178   - }
179   - ],
180   - activeName: '1'
181   - };
182   - },
183   - methods: {
184   - handleOpenChange (name) {
185   - console.log(name)
186   - },
187   - setOpenNames () {
188   - this.openNames = ['2', '3'];
189   - this.openNames2 = ['222', '222-222', '222-222-222', '222-222-222-111']
190   - this.$nextTick(() => {
191   - this.$refs.menu.updateOpened();
192   - this.$refs.menu2.updateOpened();
193   - })
194   - },
195   - addNewItem () {
196   - this.menuList[1].children[1].children.push({
197   - name: '222-222-333',
198   - children: [
199   - {
200   - name: '222-222-333-111'
201   - }
202   - ]
203   - })
204   - },
205   - changeActive () {
206   - this.activeName = String(Number(this.activeName) + 1)
207   - },
208   - hc (data) {
209   - console.log(data);
210   - }
211   - }
  44 +
212 45 }
213 46 </script>
... ...
src/styles/components/menu.less
... ... @@ -154,7 +154,8 @@
154 154 transition: all @transition-time @ease-in-out;
155 155  
156 156 &:hover{
157   - background: @background-color-select-hover;
  157 + //background: @background-color-select-hover;
  158 + color: @primary-color;
158 159 }
159 160 }
160 161  
... ... @@ -193,11 +194,22 @@
193 194 }
194 195  
195 196 &-light&-vertical &-item{
196   - border-right: 2px solid transparent;
  197 + //border-right: 2px solid transparent;
197 198 &-active:not(.@{menu-prefix-cls}-submenu){
198 199 color: @primary-color;
199   - border-right: 2px solid @primary-color;
  200 + background: ~`colorPalette("@{primary-color}", 1)`;
  201 + //border-right: 2px solid @primary-color;
200 202 z-index: 2;
  203 + &:after{
  204 + content: '';
  205 + display: block;
  206 + width: 2px;
  207 + position: absolute;
  208 + top: 0;
  209 + bottom: 0;
  210 + right: 0;
  211 + background: @primary-color;
  212 + }
201 213 }
202 214 }
203 215  
... ... @@ -214,7 +226,7 @@
214 226 }
215 227 &-active:not(.@{menu-prefix-cls}-submenu){
216 228 color: @primary-color;
217   - border-right: 2px solid @primary-color;
  229 + //border-right: 2px solid @primary-color;
218 230 }
219 231 }
220 232 &-dark&-vertical &-submenu &-item{
... ...