methods里面的方法不能用?
<div id="app3">
<p>{{one}}</p>
<p>{{two}}</p>
</div>
var app3 = new Vue({
el: '#app3',
data: {
one: '我是one',
two: 'Hello, 我是two!',
b: 3
},
methods: {
doSomething: function(){
alert(this.one),
alert(this.two),
alert(this.b)
}
}
});
<div id="app3">
<p>{{one}}</p>
<p>{{two}}</p>
</div>
var app3 = new Vue({
el: '#app3',
data: {
one: '我是one',
two: 'Hello, 我是two!',
b: 3
},
methods: {
doSomething: function(){
alert(this.one),
alert(this.two),
alert(this.b)
}
}
});
2018-05-29
举报