S
S
shasoft2018-12-19 18:47:45
Vue.js
shasoft, 2018-12-19 18:47:45

How to check if roles exist in Vue?

I made an Auth object that stores the user's parameters. I would like to do so

<div v-if="store.auth.isRole('admin')">Привет администратор!</div>
But getters don't support parameters. And actions like are not intended for reactivity.
How can this be implemented?
those. it is clear that you can make getters like isAdmin, isUser, etc. But I would like more versatility

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-12-19
@shasoft

getters do not support parameters

Support :
You can also pass arguments to getters by returning a function.
<...>
Note that getters accessed as methods will run each time they are called, and the results will not be cached.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question