Blame view

examples/routers/menu.vue 8.28 KB
e05d7289   梁灏   update Menu
1
  <template>
b3b4134d   zhigang.li   fixed https://git...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
      <div>
          <Menu ref="menu" active-name="1-2" :open-names="openNames" theme="dark" accordion @on-open-change="handleOpenChange">
              <Submenu name="1">
                  <template slot="title">
                      <Icon type="ios-analytics"></Icon>
                      Navigation One
                  </template>
                  <MenuGroup title="Item 1">
                      <MenuItem name="1-1">Option 1</MenuItem>
                      <MenuItem name="1-2">Option 2</MenuItem>
                  </MenuGroup>
                  <MenuGroup title="Item 2">
                      <MenuItem name="1-3">Option 3</MenuItem>
                      <MenuItem name="1-4">Option 4</MenuItem>
                  </MenuGroup>
c708835c   梁灏   update Menu to su...
17
              </Submenu>
b3b4134d   zhigang.li   fixed https://git...
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
              <Submenu name="2">
                  <template slot="title">
                      <Icon type="ios-filing"></Icon>
                      Navigation Two
                  </template>
                  <MenuItem name="2-1">Option 5</MenuItem>
                  <MenuItem name="2-2">Option 6</MenuItem>
                  <Submenu name="3">
                      <template slot="title">Submenu</template>
                      <MenuItem name="3-1">Option 7</MenuItem>
                      <MenuItem name="3-2">Option 8</MenuItem>
                  </Submenu>
                  <Submenu name="4">
                      <template slot="title">Submenu</template>
                      <MenuItem name="4-1">Option 7</MenuItem>
                      <MenuItem name="4-2">Option 8</MenuItem>
                  </Submenu>
              </Submenu>
              <Submenu name="5">
                  <template slot="title">
                      <Icon type="ios-gear"></Icon>
                      Navigation Three
                  </template>
                  <MenuItem name="5-1">Option 9</MenuItem>
                  <MenuItem name="5-2">Option 10</MenuItem>
                  <MenuItem name="5-3">Option 11</MenuItem>
                  <MenuItem name="5-4">Option 12</MenuItem>
              </Submenu>
          </Menu>
2b24fcce   zhigang.li   change the way to...
47
48
49
50
51
52
          <!-- <Menu theme="dark" accordion @on-open-change="handleOpenChange">
              <template v-for="item in menuList">
                  <custem-menu-item v-if="item.children" :key="`menu-${item.name}`" :parent-item="item"></custem-menu-item>
                  <menu-item v-else :name="`${item.name}`" :key="`menu-${item.name}`">{{ item.name }}</menu-item>
              </template>
          </Menu>
2b24fcce   zhigang.li   change the way to...
53
          <Button @click="addNewItem">添加菜单项</Button> -->
e549c92b   zhigang.li   fixed https://git...
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
          <Button @click="changeActive">修改激活项</Button>
          <Button @click="setOpenNames">修改展开数组</Button>
          <Menu mode="horizontal" theme="light" :active-name="activeName" @on-open-change="hc">
              <MenuItem name="1">
                  <Icon type="ios-paper"></Icon>
                  内容管理
              </MenuItem>
              <MenuItem name="2">
                  <Icon type="ios-people"></Icon>
                  用户管理
              </MenuItem>
              <Submenu name="3">
                  <template slot="title">
                      <Icon type="stats-bars"></Icon>
                      统计分析
                  </template>
                  <MenuGroup title="使用">
                      <MenuItem name="3-1">新增和启动</MenuItem>
                      <MenuItem name="3-2">活跃分析</MenuItem>
                      <MenuItem name="3-3">时段分析</MenuItem>
                  </MenuGroup>
                  <MenuGroup title="留存">
                      <MenuItem name="3-4">用户留存</MenuItem>
                      <MenuItem name="3-5">流失用户</MenuItem>
                  </MenuGroup>
              </Submenu>
              <Submenu name="4">
                  <template slot="title">
                      <Icon type="stats-bars"></Icon>
                      统计分析2
                  </template>
                  <MenuGroup title="使用2">
                      <MenuItem name="4-1">新增和启动2</MenuItem>
                      <MenuItem name="4-2">活跃分析2</MenuItem>
                      <MenuItem name="4-3">时段分析2</MenuItem>
                  </MenuGroup>
                  <MenuGroup title="留存2">
                      <MenuItem name="4-4">用户留存2</MenuItem>
                      <MenuItem name="4-5">流失用户2</MenuItem>
                  </MenuGroup>
              </Submenu>
              <MenuItem name="5">
                  <Icon type="settings"></Icon>
                  综合设置
              </MenuItem>
          </Menu>
b3b4134d   zhigang.li   fixed https://git...
100
      </div>
e05d7289   梁灏   update Menu
101
102
  </template>
  <script>
827f0234   zhigang.li   update filename
103
  import custemMenuItem from './custem-menu-item.vue'
e05d7289   梁灏   update Menu
104
      export default {
2b24fcce   zhigang.li   change the way to...
105
106
107
          components: {
              custemMenuItem
          },
b3b4134d   zhigang.li   fixed https://git...
108
109
          data () {
              return {
2b24fcce   zhigang.li   change the way to...
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
                  openNames: ['1'],
                  menuList: [
                      {
                          name: '111',
                          children: [
                              {
                                  name: '111-111'
                              },
                              {
                                  name: '111-222'
                              }
                          ]
                      },
                      {
                          name: '222',
                          children: [
                              {
                                  name: '222-111'
                              },
                              {
                                  name: '222-222',
                                  children: [
                                      {
                                          name: '222-222-111'
                                      },
                                      {
                                          name: '222-222-222',
                                          children: [
                                              {
                                                  name: '222-222-222-111'
                                              },
                                              {
                                                  name: '222-222-222-222'
                                              }
                                          ]
                                      }
                                  ]
                              },
                              {
                                  name: '222-333',
                                  children: [
                                      {
                                          name: '222-333-111',
                                          children: [
                                              {
                                                  name: '222-333-111-111'
                                              },
                                              {
                                                  name: '222-333-111-222'
                                              }
                                          ]
                                      },
                                      {
                                          name: '222-333-222',
                                          children: [
                                              {
                                                  name: '222-333-222-111'
                                              },
                                              {
                                                  name: '222-333-222-222'
                                              }
                                          ]
                                      }
                                  ]
                              }
                          ]
                      }
e549c92b   zhigang.li   fixed https://git...
177
178
                  ],
                  activeName: '1'
b3b4134d   zhigang.li   fixed https://git...
179
180
181
182
183
184
185
186
187
188
189
              };
          },
          methods: {
              handleOpenChange (name) {
                  console.log(name)
              },
              setOpenNames () {
                  this.openNames = ['2', '3'];
                  this.$nextTick(() => {
                      this.$refs.menu.updateOpened();
                  })
2b24fcce   zhigang.li   change the way to...
190
191
192
193
194
195
196
197
198
199
              },
              addNewItem () {
                  this.menuList[1].children[1].children.push({
                      name: '222-222-333',
                      children: [
                          {
                              name: '222-222-333-111'
                          }
                      ]
                  })
e549c92b   zhigang.li   fixed https://git...
200
201
202
203
204
205
              },
              changeActive () {
                  this.activeName = String(Number(this.activeName) + 1)
              },
              hc (data) {
                  console.log(data);
b3b4134d   zhigang.li   fixed https://git...
206
207
              }
          }
444907c4   梁灏   update Vue
208
      }
fc3ffbe0   梁灏   publish 0.9.10-rc-2
209
  </script>