Vue.js mounted

Jmnote (토론 | 기여)님의 2020년 10월 26일 (월) 14:16 판 (→‎개요)

1 개요

Vue.js mounted
<div id="app">
  <ul>
    <li v-for='todo in todos'>
      <span v-if='todo.completed'>✔️</span> {{ todo.title }}
    </li>
  </ul>
</div>

<script src="//unpkg.com/vue"></script>
<script src="//unpkg.com/axios"></script>
<script>
new Vue({
  el: '#app',
  data: {
    todos: []
  },
  mounted() {
    axios.get('//jsonplaceholder.typicode.com/todos')
    .then((response) => {
      this.todos = response.data;
    })
  }
});
</script>
mounted: function () {
  this.$nextTick(function () {
    // Code that will run only after the
    // entire view has been rendered
  })
}

2 같이 보기

3 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}