"Vue.js mounted"의 두 판 사이의 차이

29번째 줄: 29번째 줄:
</script>
</script>
</syntaxhighlight>
</syntaxhighlight>
<jsfiddle>81zcdev2</jsfiddle>
<jsfiddle height='200'>81zcdev2</jsfiddle>


<syntaxhighlight lang='javascript'>
<syntaxhighlight lang='javascript'>

2020년 10월 26일 (월) 13:54 판

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('https://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 }}