In a navbar I have to put a list of buttons. While some are links, others should call a method. (e.g. Home should link to /home and Log out should call a function logOut). Because of the large number of items, it is better to have an array with all the buttons/elements that should be rendered
items: [
{ divider: true },
{ icon: "tasks", text: "Today", link: "/tasks" },
{ icon: "sticky-note", text: "Notes", link: "/notes" },
{ divider: true },
{ heading: "Label" },
{ icon: "code-branch", text: "Branch" },
{ divider: true },
{ icon: "user", text: "Account", link: "/profile" },
{ icon: "cog", text: "Settings" },
{ icon: "sign-out-alt", text: "Log out", action: "logOut" }
]
However, I am not sure how to call a method using its name(the last action in the array above). I saw that in js I could use window[item.action]. Is there something similar in Vue? In other words something like @click="methods[item.action]"