|
@@ -147,7 +147,16 @@ function initComputed (vm: Component, computed: Object) {
|
|
|
|
|
|
|
|
for (const key in computed) {
|
|
for (const key in computed) {
|
|
|
const userDef = computed[key]
|
|
const userDef = computed[key]
|
|
|
- const getter = typeof userDef === 'function' ? userDef : userDef.get
|
|
|
|
|
|
|
+ let getter = typeof userDef === 'function' ? userDef : userDef.get
|
|
|
|
|
+ if (process.env.NODE_ENV !== 'production') {
|
|
|
|
|
+ if (getter === undefined) {
|
|
|
|
|
+ warn(
|
|
|
|
|
+ `No getter function has been defined for computed property "${key}".`,
|
|
|
|
|
+ vm
|
|
|
|
|
+ )
|
|
|
|
|
+ getter = noop
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
// create internal watcher for the computed property.
|
|
// create internal watcher for the computed property.
|
|
|
watchers[key] = new Watcher(vm, getter, noop, computedWatcherOptions)
|
|
watchers[key] = new Watcher(vm, getter, noop, computedWatcherOptions)
|
|
|
|
|
|