In our frontend, we want to disable certain elements (i.e. buttons) depending on whether a user has "permissions" to trigger an action or not. To keep our code clean, we would like to do something like this:
<button reqPermission="edit">
This should call a JS method connecting to our permission service and Vue should only render the element / enable it if the request is truthy.
I don't have much clue of VueJS - what I would like to avoid though, is using something like v-if="...", since this would clutter our code. Any hints on how to implement such a "custom attribute" that influences the rendering of a component would be highly appreciated. What I found so far is https://forum.vuejs.org/t/how-to-conditionally-render-a-component/69687/6
v-if.All the rest options (likev-show) will still render it in the dom. I could not understand why you want to avoid usingv-if?Vuex