We are looking to modify our frontend in order to dynamically disable certain elements (such as buttons) based on a user's specific permissions to perform an action. Our goal is to maintain clean code by implementing something like this:
<button reqPermission="edit">
The idea is for this to trigger a JavaScript method that connects to our permission service, allowing Vue to render the element and enable it only if the request returns a truthy value.
While I am not very familiar with VueJS, I am hoping to avoid using v-if="..."
as it may clutter our codebase. Any suggestions on creating a "custom attribute" that can influence component rendering would be greatly appreciated. My research led me to https://forum.vuejs.org/t/how-to-conditionally-render-a-component/69687/6