Vuetable-2: Vue warn abou computed property 'fields'

Created on 14 Jun 2017  路  3Comments  路  Source: ratiw/vuetable-2

I kept receiving this two warns and I dont know what is wrong.

[Vue warn]: The computed property "fields" is already defined in data.

```
md5-804260e7b8197a11fe90d09468e2fee2

MyComponent.js

export default {
  name: 'form-template-list',
  data () {
    return {
      fields: [
        {
          title: 'T铆tulo',
          name: 'title',
          sortField: 'title'
        },
        {
          title: 'Descri莽茫o',
          name: 'description',
          sortField: 'description'
        },
        {
          title: 'Vers茫o',
          name: 'version',
          sortField: 'version'
        },
        {
          title: 'Criado Em',
          name: 'createdAt',
          sortField: 'created_at',
          callback: 'formatDate|DD/MM/YYYY [脿s] hh:mm:ss'
        },
        {
          title: 'Respostas',
          name: 'formAnswers',
          sortField: 'formAnswers',
          callback: 'countItems'
        },
        {
          title: 'A莽玫es',
          name: '__slot:actions',
          dataClass: 'center aligned'
        }
      ],
      sortOrder: [
        {
          field: 'title',
          sortField: 'title',
          direction: 'asc'
        }
      ]
    };
  },
  methods: {
    onAction (action, data, index) {
      console.log('slot action: ', action);
      console.log('slot data: ', data);
      console.log('slot index: ', index);
    }
  }
};

Any clue why is this happening?

Most helpful comment

@arthurvasconcelos If you're using vee-validate, see this issue.

All 3 comments

have you got any mixin's loaded on the component?

The warnings are somewhat ambiguous but to me it suggests that you have a 'fields' defined in two places on the same property somewhere. might not even be related to this piece of code.

The biggest culprit i can think of is if you have a mixin loaded somewhere that has field defined in the data, and then defined again in the component itself.

@arthurvasconcelos If you're using vee-validate, see this issue.

Oh now that's make sense ... thanks for the clarification @ratiw.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

larryu picture larryu  路  6Comments

anselmobattisti picture anselmobattisti  路  5Comments

flyingcoder picture flyingcoder  路  3Comments

hanxue picture hanxue  路  3Comments

wa05 picture wa05  路  3Comments