6. two-way data binding

first

๋ฐ˜์‘์„ฑ์ด๋ž€ data์˜ ๊ฐ’ ๋ณ€๊ฒฝ์ด ๋ฐœ์ƒ์‹œ ์ฆ‰์‹œ ํŽ˜์ด์ง€์— ๋ฐ˜์˜๋˜๋Š” ๊ฒƒ์„ ๋œปํ•œ๋‹ค.

index.html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Vue</title>
    <link rel="stylesheet" href="main.css">
</head>
<body>
<div id="app" v-cloak>
    <p>{{  fullName() }}</p>
    <hr />

    <label>First Name</label>
    <input type="text" v-model="firstName">

    <label>Last Name</label>
    <input type="text" v-model="lastName">
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/3.4.6/vue.global.prod.min.js"></script>
<script src="app.js"></script>
</body>
</html>
const input = document.getElementById('first-name');

input.addEventListener('keyup', function () {
    const p = document.querySelector('p');
    
    p.innerText = this.value;
})