Commit 1a5496c8 by limin

1.2.6

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