[Vuejs]-How to get Vue3 Object single element?

1👍

check if the property is not null then render it using v-for and name the current item course

<template>
  <template v-if="courseDatas">
   <div v-for="(course, index) in courseDatas" :key="index">
    {{ index }} - {{ course}}
   </div>
  <template>
<template>

and avoid to manipulate DOM as you did, define a prop called course as follows :

<script>
export default {
props:["course"],
data() {
return {
  courseDatas: this.course
  };
 },
};

Leave a comment