1.0.5 • Published 3 years ago

@zeesuu/permission v1.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

@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>