1.0.2 • Published 2 years ago

@misterzhang/vue-auth-directive v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

vue_auth_directive

介绍

安装

    npm install @misterzhang/vue-auth-directive

配置 main.ts

import {createApp} from 'vue'
import App from './App.vue'

import authPlugin from ''

authPlugin.setResources({
     checkPermission(permissions: Array<string> | undefined): boolean {
        return false
    },

     checkRole(permissions: Array<string> | undefined): boolean {
        return false
    },

})

createApp(App).use(authPlugin).mount('#app')

使用 App.vue

    <template>
         <img  v-auth:role ="['ownerCargo','platform']"   />
         <img  v-auth:role ="'ownerCargo'"   />
         <img  v-auth:perm ="['ownerCargo','platform']"   />
         <img  v-auth:perm ="'ownerCargo'"   />
    </template>