12345678910111213141516171819202122 |
- /* @flow */
- import { warn, extend, isPlainObject } from 'core/util/index'
- export function bindObjectListeners (data: any, value: any): VNodeData {
- if (value) {
- if (!isPlainObject(value)) {
- process.env.NODE_ENV !== 'production' && warn(
- 'v-on without argument expects an Object value',
- this
- )
- } else {
- const on = data.on = data.on ? extend({}, data.on) : {}
- for (const key in value) {
- const existing = on[key]
- const ours = value[key]
- on[key] = existing ? [].concat(existing, ours) : ours
- }
- }
- }
- return data
- }
|