Could you format your code, please? This can be done using three grave accents.
``` your code ```
Will turn into
your code
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have an array of items with the title, icon, and url for each item in the array. So what I want is when a user clicks an item, they should be taken to the url. How do I render them successfully?
state: {
navigation: [
{
title: "Home",
icon: "",
url: "/"
},
{
title: "Pages",
icon: "",
url: "/pages"
},
] }
<template>
<div class="w-40 h-full fixed bg-gray-800 b-t-white text-sm font-serif font-medium antialiased text-white pl-2 pt-4 z-20">
<ul id="navigation">
<li v-for="(item, index) in navigation" :key="'item'+index">
<i v-if="item.subnav" class="icon" :class="{'ChevronLeftIcon' :!item.open, 'ChevronDownIcon' :item.open }">
</i>
<div class="title" @click="item.open = !item.open">{{item.title}}</div>
<Dropdown v-if="item.subnav" :list="item" />
</li>
</ul>
</div>
</template>
<script>
import Dropdown from './Dropdown.vue'
export default {
components:{Dropdown},
computed:{
navigation(){
return this.$store.getters.navigation;
}
}
}
</script>
I have tried wrapping the rendered item element with the router-link component and using the :to prop to navigate to the target url
But I get the following errors: (1) "item" was accessed during render but is not defined on instance & (2) Cannot read properties of undefined (reading 'url'). Please any help on how to fix this will be highly appreciated thanks.Please or to participate in this conversation.