new Vue({
el: '#some-element',
// 옵션
})
<h3 v-html='htmlString'></h3>
<img v-bind:src="a4" v-bind:height="a5" v-bind:width="a6"/>
<div id="test1">
input1: <input type='text' v-model='a1'/><br/>
input2: <input type='text' v-model='a2'/><br/>
<h1>{{a1}}</h1>
<h1>{{a2}}</h1>
</div>
<div id="example">
<my-component></my-component>
</div>
<component v-bind:is='view1'></component>
// ...
data(){
return {
message: '안녕하세요',
reversedMessage: ''
}
},
watch: {
message: function (newVal, oldVal) {
this.reversedMessage = newVal.split('').reverse().join('')
}
}
}
// ...
// ...
computed: {
fullName: {
// getter
get() {
return this.firstName + ' ' + this.lastName
},
// setter
set(newValue) {
const names = newValue.split(' ')
this.firstName = names[0]
this.lastName = names[names.length - 1]
}
}
}
// ...
<h3 v-if='a1 == 100'>a1은 100입니다.</h3>
<li v-for='a1 in array1'>
{{a1}}
</li>