console
new Vue({
el: '#exercise',
data: {
name: 'wusheng',
age: 29,
imgSrc: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1592998727296&di=a29124a5b45977eb7f62011c5c5953ba&imgtype=0&src=http%3A%2F%2Fimage.biaobaiju.com%2Fuploads%2F20180802%2F01%2F1533145496-sNbLOrnzSt.jpg'
},
methods: {
multiplyAge: function() {
return this.age*3;
},
getRandom: function() {
return Math.random();
},
inputName: function(event) {
this.name = event.target.value;
}
}
});
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<div id="exercise">
<p>VueJS is pretty cool - {{name}} ({{age}})</p>
<p>{{ age * 3 }}</p>
<p>{{getRandom()}}</p>
<div>
<img v-bind:src="imgSrc" style="width:100px;height:100px">
</div>
<div>
<input type="text" v-on:input="inputName">
</div>
</div>