[Vuejs]-How to use v-for by reading json data?

0👍

It seems that you’re trying to use the script setup syntax, and you’re missing the setup attribute in the script tag :

<script setup>
    const urls =[
        {text:'math',href:'math',icon:'bi bi-calculator'},
        {text:'chemistry',href:'chemistry',icon:'bi bi-boxes'},
    ]
</script>

it’s recommended to define your variables as reactive properties using ref or reactive :

<script setup>
  import {ref} from 'vue'
  
  const urls =ref([
        {text:'math',href:'math',icon:'bi bi-calculator'},
        {text:'chemistry',href:'chemistry',icon:'bi bi-boxes'},
    ])
</script>

Leave a comment