I create a plugin permission.js like this.
import Vue from "vue";
export default function({ store }) {
Vue.directive("can", function(el, binding) {
console.log(store.state.permissions.indexOf(binding.value) !== -1); _//true_
return store.state.permissions.indexOf(binding.value) !== -1;
});
}
Load the plugin Like
plugins: [{ src: "~/plugins/permission", ssr: true }],
And use like this
<button v-can="'add-customer'">You can edit this thing</button>
It doesn't work properly. what wrong here ?