Skip to content

Inconsistent documentation or behaviour of vm.$watch #4133

Closed
@atleta

Description

@atleta

Vue.js version

2.0.2

The following code produces the following error on the console:

const app = new Vue({
    el: '#app',
    // template: '#app-template',
    data: {
        height: 0,
        weight: 0,
    },
// ....
});
app.$watch('weight + height', function () {
  // do something
});
vue.js:2611[Vue warn]: Failed watching path: "weight + height" Watcher only accepts simple dot-delimited paths. For full control, use a function instead.

OTOH the documentation (https://vuejs.org/v2/api/#vm-watch) explicitely states that it's a valid syntax. It even has the same example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions