In my Vue
instance, I will be making a multitude of API calls to modify various variables. The initial value of these variables is not crucial.
I had hoped there might be a way to avoid defining them upon the creation of the vm, but this approach doesn't seem to work:
vm = new Vue({
el: "#app",
data: {}
});
vm.number = 3
<div id="app">
{{ number }}
</div>
If I replace data: {}
with data: { number: null }
, the code functions properly.
What I want to avoid is having to list numerous declarations like this - is there a way to skip declaring the data
variables upon instantiation?