Commit 1a5496c8 by limin

1.2.6

1 parent 54a7d113
{
"name": "glsx-components",
"description": "glsx vue components",
"version": "1.2.4",
"version": "1.2.6",
"author": "limin <17653212@qq.com>",
"license": "MIT",
"main": "dist/glsx-components.common.js",
......
......@@ -3,7 +3,7 @@
<!-- <img alt="Vue logo" src="./assets/logo.png" /> -->
<!-- <HelloWorld msg="Welcome to Your Vue.js App" />
<GLExternal url="//localhost:8080/html/employee/index.html" :subscribe="subscribe"></GLExternal> -->
<GLButton @click="click" fn="1-1-1-1" mode="el-button">232321321</GLButton>
<GLButton @click="click" fn="1-1-1-11" mode="el-button" display="disabled">232321321</GLButton>
<el-button type="primary">aaa</el-button>
<el-button type="primary" size="small">aaa</el-button>
<el-button type="primary" size="mini">aaa</el-button>
......
const TYPE = Object.freeze({
none: ''
const DISPLAY = Object.freeze({
NONE: '',
DISABLED: 'disabled'
})
// 权限校验
function permission(ctx) {
if (!ctx) return TYPE.none
const {
props: { fn, mode },
props: { fn, mode, display },
parent: {
$GLBUTTION_PERMISSIONS: { routes = [], routerBase }
}
......@@ -14,8 +14,11 @@ function permission(ctx) {
const router = routes.find(route => location.pathname === `${routerBase}${route.path.split(':/')[0]}`)
if (router && router.meta && router.meta.permissions && router.meta.permissions.includes(fn)) {
return mode
} else if (display === DISPLAY.DISABLED) {
ctx.data.attrs.disabled = true
return mode
}
return TYPE.none
return DISPLAY.NONE
}
export default {
......@@ -28,6 +31,10 @@ export default {
mode: {
type: String,
default: 'el-button'
},
display: {
type: String,
default: ''
}
},
render: function(createElement, context) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!