Commit 2d74744daf4c29f7380c6e103c6ddf59d022a2d4

Authored by 梁灏
1 parent b1c118d8

update Dropdown

update Dropdown
CHANGE.md
  1 +### Button
  2 +可以考虑是否支持 @click,而不用 @click.native
1 3 ### Input
2 4 使用 v-model
3 5 ### RadioGroup
... ...
src/components/dropdown/dropdown-item.vue
... ... @@ -42,7 +42,7 @@
42 42  
43 43 if (this.disabled) {
44 44 this.$nextTick(() => {
45   - $parent.visible = true;
  45 + $parent.currentVisible = true;
46 46 });
47 47 } else if (hasChildren) {
48 48 this.$parent.$emit('on-haschild-click');
... ...
src/components/dropdown/dropdown.vue
... ... @@ -99,7 +99,7 @@
99 99 this.currentVisible = false;
100 100 },
101 101 hasParent () {
102   - const $parent = this.$parent.$parent;
  102 + const $parent = this.$parent.$parent.$parent;
103 103 if ($parent && $parent.$options.name === 'Dropdown') {
104 104 return $parent;
105 105 } else {
... ... @@ -135,35 +135,6 @@
135 135 const $parent = this.hasParent();
136 136 if ($parent) $parent.$emit('on-haschild-click');
137 137 });
138   - },
139   -// events: {
140   -// 'on-click' (key) {
141   -// const $parent = this.hasParent();
142   -// if ($parent ) $parent.$emit('on-click', key);
143   -// },
144   -// 'on-hover-click' () {
145   -// const $parent = this.hasParent();
146   -// if ($parent) {
147   -// this.$nextTick(() => {
148   -// if (this.trigger === 'custom') return false;
149   -// this.currentVisible = false;
150   -// });
151   -// $parent.$emit('on-hover-click');
152   -// } else {
153   -// this.$nextTick(() => {
154   -// if (this.trigger === 'custom') return false;
155   -// this.currentVisible = false;
156   -// });
157   -// }
158   -// },
159   -// 'on-haschild-click' () {
160   -// this.$nextTick(() => {
161   -// if (this.trigger === 'custom') return false;
162   -// this.currentVisible = true;
163   -// });
164   -// const $parent = this.hasParent();
165   -// if ($parent) $parent.$emit('on-haschild-click');
166   -// }
167   -// }
  138 + }
168 139 };
169 140 </script>
... ...
src/styles/components/dropdown.less
... ... @@ -14,7 +14,7 @@
14 14 }
15 15  
16 16 &-rel{
17   - display: inline-block;
  17 + //display: inline-block;
18 18 position: relative;
19 19 }
20 20  
... ...
test/routers/dropdown.vue
1 1 <template>
2   - <Dropdown>
3   - <a href="javascript:void(0)">
4   - 北京小吃
5   - <Icon type="arrow-down-b"></Icon>
6   - </a>
7   - <Dropdown-menu slot="list">
8   - <Dropdown-item>驴打滚</Dropdown-item>
9   - <Dropdown-item>炸酱面</Dropdown-item>
10   - <Dropdown-item>豆汁儿</Dropdown-item>
11   - <Dropdown placement="right-start">
12   - <Dropdown-item>
13   - 北京烤鸭
14   - <Icon type="ios-arrow-right"></Icon>
15   - </Dropdown-item>
16   - <Dropdown-menu slot="list">
17   - <Dropdown-item>挂炉烤鸭</Dropdown-item>
18   - <Dropdown-item>焖炉烤鸭</Dropdown-item>
19   - </Dropdown-menu>
20   - </Dropdown>
21   - <Dropdown-item>冰糖葫芦</Dropdown-item>
22   - </Dropdown-menu>
23   - </Dropdown>
  2 + <div>
  3 + <Dropdown>
  4 + <a href="javascript:void(0)">
  5 + 下拉菜单
  6 + <Icon type="arrow-down-b"></Icon>
  7 + </a>
  8 + <Dropdown-menu slot="list">
  9 + <Dropdown-item>驴打滚</Dropdown-item>
  10 + <Dropdown-item>炸酱面</Dropdown-item>
  11 + <Dropdown-item disabled>豆汁儿</Dropdown-item>
  12 + <Dropdown-item>冰糖葫芦</Dropdown-item>
  13 + <Dropdown-item divided>北京烤鸭</Dropdown-item>
  14 + </Dropdown-menu>
  15 + </Dropdown>
  16 + <Dropdown style="margin-left: 20px">
  17 + <Button type="primary">
  18 + 下拉菜单
  19 + <Icon type="arrow-down-b"></Icon>
  20 + </Button>
  21 + <Dropdown-menu slot="list">
  22 + <Dropdown-item>驴打滚</Dropdown-item>
  23 + <Dropdown-item>炸酱面</Dropdown-item>
  24 + <Dropdown-item disabled>豆汁儿</Dropdown-item>
  25 + <Dropdown-item>冰糖葫芦</Dropdown-item>
  26 + <Dropdown-item divided>北京烤鸭</Dropdown-item>
  27 + </Dropdown-menu>
  28 + </Dropdown>
  29 + </div>
24 30 </template>
25 31 <script>
26 32 export default {
... ...