@zeesuu/permission
v1.0.5
Published
Permission directive of vue
Downloads
1
Readme
@zeesuu/permission
$ npm i @zeessu/permission -S
Usage
. Step 1
Import the directive
// main.js
import Permission from 'comp/Permission';
Vue.use(Permission);
. Step 2
// login.js
login().then((res) => {
// customice set permission to store => set store getters to store.getters.$permission
this.store.dispatch('setPermissionActionName', res.permission);
});
<!-- vue file -->
<template>
<div>
<!-- Set this buttons permission array-->
<!-- the button will be show if store.getters.$permission has one or more permission in this directive params-->
<button v-permission="["article:editor"]"></button>
</div>
</template>