|
|
@@ -38,8 +38,18 @@ export default function (Vue) {
|
|
|
if (eventRE.test(name)) {
|
|
|
name = name.replace(eventRE, '')
|
|
|
handler = (vm._scope || vm._context).$eval(attrs[i].value, true)
|
|
|
- handler._fromParent = true
|
|
|
- vm.$on(name.replace(eventRE), handler)
|
|
|
+ if (typeof handler === 'function') {
|
|
|
+ handler._fromParent = true
|
|
|
+ vm.$on(name.replace(eventRE), handler)
|
|
|
+ } else if (process.env.NODE_ENV !== 'production') {
|
|
|
+ warn(
|
|
|
+ 'v-on:' + name + '="' + attrs[i].value + '"' + (
|
|
|
+ vm.$options.name
|
|
|
+ ? ' on component <' + vm.$options.name + '>'
|
|
|
+ : ''
|
|
|
+ ) + ' expects a function value, got ' + handler
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|