template
Vue template 출력
Mustache 구문

v-bind directive
「v-html」 vs 「v-text」

「v-text」 vs 「mustache」



Last updated





Last updated
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>v-model example</title>
<style>
</style>
</head>
<body>
<div id="app">
<h1>한줄평 작성</h1>
<input type="text" placeholder="한줄평 작성" v-model="comment">
<h4>{{comment}}</h4>
<h4>글자수 : {{comment.length}}</h4>
</div>
<script src="https://unpkg.com/vue@next"></script>
<script>
const app = Vue.createApp({
data(){
return {
comment:"",
};
}
});
app.mount("#app");
</script>
</body>
</html><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>vue template example</title>
<style>
textarea {
width: 400px;
height:150px;
resize: none;
font-size: 20px;
padding: 0.5em;
}
</style>
</head>
<body>
<div id="app">
<h1>글자 입력</h1>
<textarea v-model="sample" v-on:input="sample = $event.target.value"></textarea>
<h2>v-html</h2>
<div v-html="sample"></div>
<h2>v-text</h2>
<div v-text="sample"></div>
<h2>mustache</h2>
<div>{{sample}}</div>
</div>
<script src="https://unpkg.com/vue@next"></script>
<script>
const app = Vue.createApp({
data(){
return {
sample:"",
};
}
});
app.mount("#app");
</script>
</body>
</html>