diff --git a/src/core/instance/render-helpers/bind-object-listeners.js b/src/core/instance/render-helpers/bind-object-listeners.js index e97540fdf4..5bfc751432 100644 --- a/src/core/instance/render-helpers/bind-object-listeners.js +++ b/src/core/instance/render-helpers/bind-object-listeners.js @@ -14,7 +14,7 @@ export function bindObjectListeners (data: any, value: any): VNodeData { for (const key in value) { const existing = on[key] const ours = value[key] - on[key] = existing ? [].concat(ours, existing) : ours + on[key] = existing ? [].concat(existing, ours) : ours } } } diff --git a/test/unit/features/directives/on.spec.js b/test/unit/features/directives/on.spec.js index b65ec37948..a32bcaab2d 100644 --- a/test/unit/features/directives/on.spec.js +++ b/test/unit/features/directives/on.spec.js @@ -759,7 +759,7 @@ describe('Directive v-on', () => { const mouseup = jasmine.createSpy('mouseup') const mousedown = jasmine.createSpy('mousedown') - var vm = new Vue({ + vm = new Vue({ el, template: ` { expect(mousedown.calls.count()).toBe(1) }) + // #6805 (v-on="object" bind order problem) + it('object syntax (no argument): should fire after high-priority listeners', done => { + const MyCheckbox = { + template: '', + props: { + value: false + }, + computed: { + model: { + get () { + return this.value + }, + set (val) { + this.$emit('input', val) + } + } + } + } + + vm = new Vue({ + el, + template: ` +
+ +
+ `, + components: { MyCheckbox }, + data: { + check: false + }, + methods: { + change () { + expect(this.check).toBe(true) + done() + } + } + }) + + vm.$el.querySelector('input').click() + }) + it('warn object syntax with modifier', () => { new Vue({ template: ``