Answer the question
In order to leave comments, you need to log in
What should you use Vue.observable for?
I read an article about Vue.observable here.
The article has an example.
import Vue from vue;
const state = Vue.observable({
counter: 0,
});
export default {
render() {
return (
<div>
{state.counter}
<button v-on:click={() => { state.counter++; }}>
Increment counter
</button>
</div>
);
},
};
Answer the question
In order to leave comments, you need to log in
Vue.observable
allows you to create objects that are not tied to a specific component, changes in which will cause all dependent elements to be redrawn.
Roughly speaking, this is a lower level of abstraction. When you create an object in a section data
somewhere, internally Vue uses Vue.observable
. It's just now that this feature has become available globally.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question