๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
JavaScript/Vue

[Vue.js] v-bind

by ์ฝ”๋”ฉํ•˜๋Š” ๋ถ•์–ด 2022. 6. 6.
๋ฐ˜์‘ํ˜•

v-bind๋Š” ์•„์ด๋””, ํด๋ž˜์Šค, ์Šคํƒ€์ผ ๋“ฑ์˜ HTML ์†์„ฑ ๊ฐ’์— ๋ทฐ ๋ฐ์ดํ„ฐ ๊ฐ’์„ ์—ฐ๊ฒฐํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ๋ฐ์ดํ„ฐ ์—ฐ๊ฒฐ ๋ฐฉ์‹์ด๋‹ค.

v-bind ์†์„ฑ์œผ๋กœ ์ง€์ •ํ•  HTML ์†์„ฑ์ด๋‚˜ props ์†์„ฑ ์•ž์— ์ ‘๋‘์‚ฌ๋กœ ๋ถ™์—ฌ์ค€๋‹ค.

 

 

<!DOCTYPE html>
<head>
  <title>v-bind</title>
</head>
<body>
  <div id="app">
    <p v-bind:id="idA">์•„์ด๋”” ๋ฐ”์ธ๋”ฉ</p>
    <p v-bind:class="classA">ํด๋ž˜์Šค ๋ฐ”์ธ๋”ฉ</p>
    <p v-bind:style="styleA">์Šคํƒ€์ผ ๋ฐ”์ธ๋”ฉ</p>
  </div>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  <script>
    new Vue({
      el: '#app',
      data: {
        idA: 10,
        classA: 'container',
        styleA: 'color: blue'
      }
    })
  </script>
</body>
</html>

 

๋ฐ˜์‘ํ˜•

'JavaScript > Vue' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[Vue.js] Vue Directive  (0) 2022.06.06
[Vue.js] Vue์—์„œ์˜ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ํ‘œํ˜„์‹  (0) 2022.06.06
Named View  (0) 2022.06.06
Nested Router  (0) 2022.06.06
[Vue.js] router URL์˜ ํ•ด์‹œ ๊ฐ’(#)์„ ์—†์• ๋Š” ๋ฒ•  (0) 2022.06.06

๋Œ“๊ธ€