var app = new Vue({
el: '#app',
data: {
message: 'Hello Vue!',
obj:{
}
},
created(){
console.log('create');
this.obj.name = 2;
},
methods:{
changeName(){
this.obj.name = 'changed';
console.log('changed');
}
}
})
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
{{ message }}{{obj.name}}
<input type="button" @click="changeName" value="BTN">
</div>
</body>
</html>