hqit-plugin-plus
v1.0.14
Published
hqit-plugin for vue3
Downloads
14
Maintainers
Readme
hqit-plugin-plus
Installation
npm
npm install hqit-plugin-plus
yarn
yarn add hqit-plugin-plus
Usage
权限路由 && 自定义指令
import Vue from 'vue'
import App from './App.vue'
import router, {asyncRouterMap} from "./router"
import {getUser} from "./api"
import hqitPluginPlus from "hqit-plugin-plus"
type Elmessage {
warning: (message: string) => void {
// Indicates routing error,called by the plugin
}
}
type Config {
router: router,
asyncRouterMap: asyncRouterMap<{...route,roles: [{key: resourceId,value: privilege}]}>,
getUser: getUser,
authKey?: "authorities",// defaultValue:"authorities"
Message: ElMessage
}
const config<Config>;
const app = createApp(App);
app.use(init, {...config});
// 单个权限,利用自定义指令
<button v-permission="{key: resourceId, value: privilege}" />
Utils
import { _utils, compressImage, initRem} from "hqit-plugin-plus"
//图片压缩
interface CompressOptions {
quality?: number; //默认0.92
noCompressIfLarger?: boolean;
maxWidth?: number;
maxHeight?: number;
}
const _blob = await compressImage(file, compressOptions):Blob
const baseSize<number> = 192;
initRem(baseSize)