N
N
Nurlan2017-05-30 22:29:28
Vue.js
Nurlan, 2017-05-30 22:29:28

Why does computed throw an error when changing a property on an event?

Greetings.
I'm learning Vue.
I worked with computed and came across an error (example):
jsbin.com/buqebajape/edit?html,js,console,output
When loading, everything works, but when I click on the span, an error occurs. Although if you change the property through the console, then everything works out.
Why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Kulakov, 2017-05-30
@daager

When the reverse method is called, it makes this.message a number, and the number does not have a split method, which causes an error. Look at the browser console:

TypeError: this.message.split is not a function
    at pt.reversedMessage (milihexife.js:14:37)
...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question