<div id="test">
</body>
<script>
new Vue({
el: '#test',
computed: {
checkEvenNumber: function(){
return 20 % 2 == 0 ? '짝수' : '홀수';
}
}
})
</script>
<div id="test">
<h1> 더하기 는 입니다</h>
<h1> 빼기 는 입니다</h>
</div>
</div>
</body>
<script>
var memberData = {
firstNum : 10,
secondNum : 20
};
var memberMethod = {
addNum : function(num1, num2){
return num1 + num2;
},
MinusNum : function(num1, num2){
return num1 - num2;
}
}
var option = {
el : '#test',
data : memberData,
methods : memberMethod
};
var vue = new Vue({
el : '#test',
data : memberData,
methods : memberMethod
});
<div id="test">
제 이름은 입니다 <br>
<input v-model="myName">
</div>
</body>
<script>
var vm = new Vue({
el: '#test',
data: {
myName: 'wwwwww',
text: '변경 전입니다'
},
watch: {
myName: function (val) {
text = '이름이'+this.myName+'으로 변경되었습니다';
}
}
})
</script>