Vue.js Composition API

Jmnote (토론 | 기여)님의 2023년 10월 17일 (화) 14:01 판 (새 문서: ==개요== ;Composition API <syntaxhighlight lang='html'> <script setup> import { ref, onMounted } from 'vue' // reactive state const count = ref(0) // functions that mutate state...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요

Composition API
<script setup>
import { ref, onMounted } from 'vue'

// reactive state
const count = ref(0)

// functions that mutate state and trigger updates
function increment() {
  count.value++
}

// lifecycle hooks
onMounted(() => {
  console.log(`The initial count is ${count.value}.`)
})
</script>

<template>
  <button @click="increment">Count is: {{ count }}</button>
</template>


2 같이 보기

  • [[ ]]
  • [[ ]]
  • [[ ]]
  • [[ ]]
  • [[ ]]
  • [[ ]]

3 참고

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