R
R
Roman2019-06-14 13:15:22
Vue.js
Roman, 2019-06-14 13:15:22

In which block should the vm.$watch('abc', function (newVal, oldVal) { construct be inserted in vue-cli?

I decided to try an alternative version of watch https://ru.vuejs.org/v2/api/#vm-watch
but I don’t understand where exactly to insert the construction (replaced vm with this - right?) I
’m constantly confused - the manual is written for this vm (why- then) - but in fact there is no vm in single-file scripts ,
plz tell me
thanks!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Kulakov, 2019-06-14
@procode

vm is short for view-model. It's essentially a vue instance, and inside the component, it's this.
$watch is usually placed in a component's hooks - created() or mounted() for example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question