add stopPropagation for dropdown

This commit is contained in:
troy351 2019-03-22 17:59:01 +08:00 committed by GitHub
parent f0de3cc7a9
commit c7f705d071
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,6 +57,10 @@
transferClassName: { transferClassName: {
type: String type: String
}, },
stopPropagation: {
type: Boolean,
default: false
},
}, },
computed: { computed: {
transition () { transition () {
@ -164,6 +168,7 @@
}, },
mounted () { mounted () {
this.$on('on-click', (key) => { this.$on('on-click', (key) => {
if (this.stopPropagation) return;
const $parent = this.hasParent(); const $parent = this.hasParent();
if ($parent) $parent.$emit('on-click', key); if ($parent) $parent.$emit('on-click', key);
}); });