0

How to pass asynchronous values ​​from display to method - Vue?

The return is an error indicating that the function does not exist.

Where can I be wrong?

Thank you guys

methods: {
      teste (value) {
        console.log(value)
      }
},
display: function () {
      this.teste(true)
}

[Vue warn]: Error in render: "TypeError: _this2.teste is not a function"

1 Answer 1

1

Why you would need to add a display function at the component level? You should not have functions outside of methods object, for a component. Because these are not part of Vue components conception.

methods: {
      teste (value) {
         console.log(value)
      },
      display: function () {
         this.teste(true)
      }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.