Vue3.js (2) 데이터 바인딩

Bada Jung·2022년 1월 10일
0

Vue

목록 보기
2/20
post-thumbnail
데이터 바인딩
app.vue
<template>
  <div>
    <!-- 데이터 바인딩 -->
    <h1>Hello {{ username }}!</h1>
    <h1 v-text="username"></h1>
    <h1>안녕하세요 저는 {{ user.name }} 입니다.</h1>
    <h1>저의 직업은 {{ user.job }}입니다.</h1>
    <h1>그리고 저는 올해 {{ user.age }}살 입니다.</h1>
    <h1 v-html="button"></h1>
  </div>
</template>

<script>
export default {
  name: "App",
  data() {
    return {
      dynamicId: "content",
      url: "https://naver.com",
      image: {
        src: "https://placeimg.com/100/100/any",
        alt: "random image",
      },
      inputType: "color",
      pStyle: "color: red; font-size: 36px",
      isDone: false,
      textDecoration: "line-through",
      username: "bada",
      year: 2021,
      user: {
        name: "bada",
        job: "programmer",
        age: 100,
      },
      button: "<button>Click</button>",
    };
  },
};
</script>

<style>
#content {
  color: blue;
  background: pink;
}
#title {
  color: red;
  background: yellow;
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
.line-through {
  text-decoration: line-through;
}
.text-red {
  color: red;
}
.text-green {
  color: green;
}
.highlight {
  font-weight: bold;
  background: pink;
}
</style>
profile
🌊🌊Under the SEA🌊🌊

0개의 댓글