Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

freemium's avatar

inertia link is't working by passing object

<side-menu :account="account"></side-menu>

  data() {
    return {
      account: {
        redirectto: "/logout",
        dropdownname: "Account",
        drodownmenu: "Logout",
        method: "post",
      },
    };
  },

SideMenu Component

<template>
  <li class="nav-item dropdown">
    <a
      class="nav-link dropdown-toggle"
      href="#"
      data-bs-toggle="dropdown"
      data-bs-auto-close="outside"
    >
      {{ account.dropdownname }}
    </a>
    <ul class="dropdown-menu">
      <li class="dropdown">
        <Link
          class="dropdown-item"
          :href="account.redirectto"
          :method="account.method"
          >{{ account.drodownmenu }}
        </Link>
      </li>
    </ul>
  </li>
</template>
<script>
import { Link } from "@inertiajs/inertia-vue3";

export default {
  name: "SideMenu",
  props: {
    account: Object,
  },
  component: {
    Link,
  },
};
</script>

help needed please

0 likes
6 replies
Sinnbeck's avatar

"isn't working". Pleas say more. Error? Wrong url?

freemium's avatar

@Sinnbeck Sir it rendering like

<link class="dropdown-item" href="/logout" method="post">
freemium's avatar

@Sinnbeck sir when i tested in other component it works as expected ....

  <Link method="post" href="/logout" class="dropdown-item">
          Logout
            </Link>

i made <side-menu :account="account"></side-menu> component for list of all menu ...and the problem is it's not rendering <Link /> to <a> </a>

anilkumarthakur60's avatar

i think the mistake is with naming..... it should be

components: {
 }

not

component: {
 }

Please or to participate in this conversation.