Vue for문

suyeon·2022년 2월 28일
0

for문 형식

<li v-for="(note, index) in notes" :key="index">{{note}}</li>

전체 코드

<template>
  <ul>
    <li v-for="(note, index) in notes" :key="index">{{note}}</li>
  </ul>
</template>

<script>
import {useStore} from "vuex";
import {computed,} from 'vue';

export default {
  name: 'NotesComponent',
  components: {AddNewNote},
  setup() {
    const store = useStore();
    const notes = computed(() => store.state.notes)

    return {
      notes,
    }
  }
}
</script>

0개의 댓글