Commit bd56b391eaa41fa8a7c69817b61b84c7ab973e7c
Committed by
GitHub
Merge pull request #5489 from troy351/2.0
feature: add stopPropagation for Dropdown
Showing
1 changed file
with
5 additions
and
0 deletions
Show diff stats
src/components/dropdown/dropdown.vue
| @@ -57,6 +57,10 @@ | @@ -57,6 +57,10 @@ | ||
| 57 | transferClassName: { | 57 | transferClassName: { |
| 58 | type: String | 58 | type: String |
| 59 | }, | 59 | }, |
| 60 | + stopPropagation: { | ||
| 61 | + type: Boolean, | ||
| 62 | + default: false | ||
| 63 | + }, | ||
| 60 | }, | 64 | }, |
| 61 | computed: { | 65 | computed: { |
| 62 | transition () { | 66 | transition () { |
| @@ -164,6 +168,7 @@ | @@ -164,6 +168,7 @@ | ||
| 164 | }, | 168 | }, |
| 165 | mounted () { | 169 | mounted () { |
| 166 | this.$on('on-click', (key) => { | 170 | this.$on('on-click', (key) => { |
| 171 | + if (this.stopPropagation) return; | ||
| 167 | const $parent = this.hasParent(); | 172 | const $parent = this.hasParent(); |
| 168 | if ($parent) $parent.$emit('on-click', key); | 173 | if ($parent) $parent.$emit('on-click', key); |
| 169 | }); | 174 | }); |