Merge branch 'master' into deploy

This commit is contained in:
Pan 2019-01-15 14:15:16 +08:00
commit f6ede59859
19 changed files with 211 additions and 126 deletions

View File

@ -92,7 +92,7 @@ Become a sponsor and get your logo on our README on GitHub with a link to your s
- Multiple dynamic themes - Multiple dynamic themes
- Dynamic sidebar (supports multi-level routing) - Dynamic sidebar (supports multi-level routing)
- Dynamic breadcrumb - Dynamic breadcrumb
- Tags-view(Tab page Support right-click operation) - Tags-view (Tab page Support right-click operation)
- Svg Sprite - Svg Sprite
- Mock data - Mock data
- Screenfull - Screenfull

View File

@ -40,7 +40,7 @@
- [Wiki](https://github.com/PanJiaChen/vue-element-admin/wiki) - [Wiki](https://github.com/PanJiaChen/vue-element-admin/wiki)
- [Donate](https://panjiachen.github.io/vue-element-admin-site/zh/donate/) - [Donate](https://panjiachen.gitee.io/vue-element-admin-site/zh/donate)
- [Gitee](https://panjiachen.gitee.io/vue-element-admin/) 国内用户可访问该地址在线预览 - [Gitee](https://panjiachen.gitee.io/vue-element-admin/) 国内用户可访问该地址在线预览
@ -214,6 +214,8 @@ Detailed changes for each release are documented in the [release notes](https://
如果你觉得这个项目帮助到了你,你可以帮作者买一杯果汁表示鼓励 :tropical_drink: 如果你觉得这个项目帮助到了你,你可以帮作者买一杯果汁表示鼓励 :tropical_drink:
![donate](https://panjiachen.github.io/donate/donation.png) ![donate](https://panjiachen.github.io/donate/donation.png)
[更多捐赠方式](https://panjiachen.gitee.io/vue-element-admin-site/zh/donate)
[Paypal Me](https://www.paypal.me/panfree23) [Paypal Me](https://www.paypal.me/panfree23)
## Browsers support ## Browsers support

View File

@ -150,7 +150,6 @@ if (config.build.productionGzip) {
webpackConfig.plugins.push( webpackConfig.plugins.push(
new CompressionWebpackPlugin({ new CompressionWebpackPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip', algorithm: 'gzip',
test: new RegExp( test: new RegExp(
'\\.(' + config.build.productionGzipExtensions.join('|') + ')$' '\\.(' + config.build.productionGzipExtensions.join('|') + ')$'

View File

@ -1,6 +1,6 @@
{ {
"name": "vue-element-admin", "name": "vue-element-admin",
"version": "3.9.3", "version": "3.10.0",
"description": "A magical vue admin. Typical templates for enterprise applications. Newest development stack of vue. Lots of awesome features", "description": "A magical vue admin. Typical templates for enterprise applications. Newest development stack of vue. Lots of awesome features",
"author": "Pan <panfree23@gmail.com>", "author": "Pan <panfree23@gmail.com>",
"license": "MIT", "license": "MIT",
@ -77,6 +77,7 @@
"babel-preset-env": "1.7.0", "babel-preset-env": "1.7.0",
"babel-preset-stage-2": "6.24.1", "babel-preset-stage-2": "6.24.1",
"chalk": "2.4.1", "chalk": "2.4.1",
"compression-webpack-plugin": "2.0.0",
"copy-webpack-plugin": "4.5.2", "copy-webpack-plugin": "4.5.2",
"cross-env": "5.2.0", "cross-env": "5.2.0",
"css-loader": "1.0.0", "css-loader": "1.0.0",
@ -117,7 +118,7 @@
"webpack": "4.16.5", "webpack": "4.16.5",
"webpack-bundle-analyzer": "2.13.1", "webpack-bundle-analyzer": "2.13.1",
"webpack-cli": "3.1.0", "webpack-cli": "3.1.0",
"webpack-dev-server": "3.1.5", "webpack-dev-server": "3.1.14",
"webpack-merge": "4.1.4" "webpack-merge": "4.1.4"
}, },
"engines": { "engines": {

View File

@ -18,7 +18,8 @@ export default {
} }
}, },
watch: { watch: {
theme(val, oldVal) { theme(val) {
const oldVal = this.theme
if (typeof val !== 'string') return if (typeof val !== 'string') return
const themeCluster = this.getThemeCluster(val.replace('#', '')) const themeCluster = this.getThemeCluster(val.replace('#', ''))
const originalCluster = this.getThemeCluster(oldVal.replace('#', '')) const originalCluster = this.getThemeCluster(oldVal.replace('#', ''))

View File

@ -87,7 +87,8 @@ export default {
}, },
permission: { permission: {
roles: 'Your roles', roles: 'Your roles',
switchRoles: 'Switch roles' switchRoles: 'Switch roles',
tips: 'In some cases it is not suitable to use v-permission, such as element Tab component or el-table-column and other asynchronous rendering dom cases which can only be achieved by manually setting the v-if.'
}, },
guide: { guide: {
description: 'The guide page is useful for some people who entered the project for the first time. You can briefly introduce the features of the project. Demo is based on ', description: 'The guide page is useful for some people who entered the project for the first time. You can briefly introduce the features of the project. Demo is based on ',

View File

@ -87,7 +87,8 @@ export default {
}, },
permission: { permission: {
roles: 'Tus permisos', roles: 'Tus permisos',
switchRoles: 'Cambiar permisos' switchRoles: 'Cambiar permisos',
tips: 'In some cases it is not suitable to use v-permission, such as element Tab component or el-table-column and other asynchronous rendering dom cases which can only be achieved by manually setting the v-if.'
}, },
guide: { guide: {
description: 'The guide page is useful for some people who entered the project for the first time. You can briefly introduce the features of the project. Demo is based on ', description: 'The guide page is useful for some people who entered the project for the first time. You can briefly introduce the features of the project. Demo is based on ',

View File

@ -87,7 +87,8 @@ export default {
}, },
permission: { permission: {
roles: '你的权限', roles: '你的权限',
switchRoles: '切换权限' switchRoles: '切换权限',
tips: '在某些情况下,不适合使用 v-permission。例如Element-UI 的 Tab 组件或 el-table-column 以及其它动态渲染 dom 的场景。你只能通过手动设置 v-if 来实现。'
}, },
guide: { guide: {
description: '引导页对于一些第一次进入项目的人很有用,你可以简单介绍下项目的功能。本 Demo 是基于', description: '引导页对于一些第一次进入项目的人很有用,你可以简单介绍下项目的功能。本 Demo 是基于',

View File

@ -33,7 +33,7 @@ router.beforeEach((to, from, next) => {
}) })
}).catch((err) => { }).catch((err) => {
store.dispatch('FedLogOut').then(() => { store.dispatch('FedLogOut').then(() => {
Message.error(err || 'Verification failed, please login again') Message.error(err)
next({ path: '/' }) next({ path: '/' })
}) })
}) })

View File

@ -3,7 +3,7 @@ import Cookies from 'js-cookie'
const app = { const app = {
state: { state: {
sidebar: { sidebar: {
opened: !+Cookies.get('sidebarStatus'), opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
withoutAnimation: false withoutAnimation: false
}, },
device: 'desktop', device: 'desktop',
@ -12,16 +12,16 @@ const app = {
}, },
mutations: { mutations: {
TOGGLE_SIDEBAR: state => { TOGGLE_SIDEBAR: state => {
state.sidebar.opened = !state.sidebar.opened
state.sidebar.withoutAnimation = false
if (state.sidebar.opened) { if (state.sidebar.opened) {
Cookies.set('sidebarStatus', 1) Cookies.set('sidebarStatus', 1)
} else { } else {
Cookies.set('sidebarStatus', 0) Cookies.set('sidebarStatus', 0)
} }
state.sidebar.opened = !state.sidebar.opened
state.sidebar.withoutAnimation = false
}, },
CLOSE_SIDEBAR: (state, withoutAnimation) => { CLOSE_SIDEBAR: (state, withoutAnimation) => {
Cookies.set('sidebarStatus', 1) Cookies.set('sidebarStatus', 0)
state.sidebar.opened = false state.sidebar.opened = false
state.sidebar.withoutAnimation = withoutAnimation state.sidebar.withoutAnimation = withoutAnimation
}, },

View File

@ -63,15 +63,16 @@ const user = {
GetUserInfo({ commit, state }) { GetUserInfo({ commit, state }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getUserInfo(state.token).then(response => { getUserInfo(state.token).then(response => {
if (!response.data) { // 由于mockjs 不支持自定义状态码只能这样hack // 由于mockjs 不支持自定义状态码只能这样hack
reject('error') if (!response.data) {
reject('Verification failed, please login again.')
} }
const data = response.data const data = response.data
if (data.roles && data.roles.length > 0) { // 验证返回的roles是否是一个非空数组 if (data.roles && data.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', data.roles) commit('SET_ROLES', data.roles)
} else { } else {
reject('getInfo: roles must be a non-null array !') reject('getInfo: roles must be a non-null array!')
} }
commit('SET_NAME', data.name) commit('SET_NAME', data.name)

View File

@ -2,8 +2,10 @@
@mixin colorBtn($color) { @mixin colorBtn($color) {
background: $color; background: $color;
&:hover { &:hover {
color: $color; color: $color;
&:before, &:before,
&:after { &:after {
background: $color; background: $color;
@ -49,14 +51,17 @@
transition: 600ms ease all; transition: 600ms ease all;
position: relative; position: relative;
display: inline-block; display: inline-block;
&:hover { &:hover {
background: #fff; background: #fff;
&:before, &:before,
&:after { &:after {
width: 100%; width: 100%;
transition: 600ms ease all; transition: 600ms ease all;
} }
} }
&:before, &:before,
&:after { &:after {
content: ''; content: '';
@ -67,6 +72,7 @@
width: 0; width: 0;
transition: 400ms ease all; transition: 400ms ease all;
} }
&::after { &::after {
right: inherit; right: inherit;
top: inherit; top: inherit;
@ -91,4 +97,3 @@
font-size: 14px; font-size: 14px;
border-radius: 4px; border-radius: 4px;
} }

View File

@ -1,59 +1,61 @@
//覆盖一些element-ui样式 //覆盖一些element-ui样式
.el-breadcrumb__inner, .el-breadcrumb__inner a{ .el-breadcrumb__inner,
font-weight: 400!important; .el-breadcrumb__inner a {
font-weight: 400 !important;
} }
.el-upload { .el-upload {
input[type="file"] { input[type="file"] {
display: none !important; display: none !important;
} }
} }
.el-upload__input { .el-upload__input {
display: none; display: none;
} }
.cell { .cell {
.el-tag { .el-tag {
margin-right: 0px; margin-right: 0px;
} }
} }
.small-padding { .small-padding {
.cell { .cell {
padding-left: 5px; padding-left: 5px;
padding-right: 5px; padding-right: 5px;
} }
} }
.fixed-width{ .fixed-width {
.el-button--mini{ .el-button--mini {
padding: 7px 10px; padding: 7px 10px;
width: 60px; width: 60px;
} }
} }
.status-col { .status-col {
.cell { .cell {
padding: 0 10px; padding: 0 10px;
text-align: center; text-align: center;
.el-tag { .el-tag {
margin-right: 0px; margin-right: 0px;
} }
} }
} }
//暂时性解决dialog 问题 https://github.com/ElemeFE/element/issues/2461 //暂时性解决dialog 问题 https://github.com/ElemeFE/element/issues/2461
.el-dialog { .el-dialog {
transform: none; transform: none;
left: 0; left: 0;
position: relative; position: relative;
margin: 0 auto; margin: 0 auto;
} }
//文章页textarea修改样式 //文章页textarea修改样式
.article-textarea { .article-textarea {
textarea { textarea {
padding-right: 40px; padding-right: 40px;
resize: none; resize: none;
@ -61,22 +63,23 @@
border-radius: 0px; border-radius: 0px;
border-bottom: 1px solid #bfcbd9; border-bottom: 1px solid #bfcbd9;
} }
} }
//element ui upload //element ui upload
.upload-container { .upload-container {
.el-upload { .el-upload {
width: 100%; width: 100%;
.el-upload-dragger { .el-upload-dragger {
width: 100%; width: 100%;
height: 200px; height: 200px;
} }
} }
} }
//dropdown //dropdown
.el-dropdown-menu{ .el-dropdown-menu {
a{ a {
display: block display: block
} }
} }

View File

@ -22,7 +22,7 @@ html {
box-sizing: border-box; box-sizing: border-box;
} }
#app{ #app {
height: 100%; height: 100%;
} }
@ -53,9 +53,9 @@ a:hover {
text-decoration: none; text-decoration: none;
} }
div:focus{ div:focus {
outline: none; outline: none;
} }
.fr { .fr {
float: right; float: right;
@ -104,23 +104,26 @@ code {
line-height: 36px; line-height: 36px;
font-size: 15px; font-size: 15px;
font-family: "Source Sans Pro", "Helvetica Neue", Arial, sans-serif; font-family: "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
a { a {
color: #337ab7; color: #337ab7;
cursor: pointer; cursor: pointer;
&:hover { &:hover {
color: rgb(32, 160, 255); color: rgb(32, 160, 255);
} }
} }
} }
.warn-content{ .warn-content {
background: rgba(66,185,131,.1); background: rgba(66, 185, 131, .1);
border-radius: 2px; border-radius: 2px;
padding: 16px; padding: 16px;
padding: 1rem; padding: 1rem;
line-height: 1.6rem; line-height: 1.6rem;
word-spacing: .05rem; word-spacing: .05rem;
a{
a {
color: #42b983; color: #42b983;
font-weight: 600; font-weight: 600;
} }
@ -153,13 +156,16 @@ code {
padding-right: 20px; padding-right: 20px;
transition: 600ms ease position; transition: 600ms ease position;
background: linear-gradient(90deg, rgba(32, 182, 249, 1) 0%, rgba(32, 182, 249, 1) 0%, rgba(33, 120, 241, 1) 100%, rgba(33, 120, 241, 1) 100%); background: linear-gradient(90deg, rgba(32, 182, 249, 1) 0%, rgba(32, 182, 249, 1) 0%, rgba(33, 120, 241, 1) 100%, rgba(33, 120, 241, 1) 100%);
.subtitle { .subtitle {
font-size: 20px; font-size: 20px;
color: #fff; color: #fff;
} }
&.draft { &.draft {
background: #d0d0d0; background: #d0d0d0;
} }
&.deleted { &.deleted {
background: #d0d0d0; background: #d0d0d0;
} }
@ -169,6 +175,7 @@ code {
.link-type:focus { .link-type:focus {
color: #337ab7; color: #337ab7;
cursor: pointer; cursor: pointer;
&:hover { &:hover {
color: rgb(32, 160, 255); color: rgb(32, 160, 255);
} }
@ -176,6 +183,7 @@ code {
.filter-container { .filter-container {
padding-bottom: 10px; padding-bottom: 10px;
.filter-item { .filter-item {
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;

View File

@ -10,9 +10,11 @@
&::-webkit-scrollbar-track-piece { &::-webkit-scrollbar-track-piece {
background: #d3dce6; background: #d3dce6;
} }
&::-webkit-scrollbar { &::-webkit-scrollbar {
width: 6px; width: 6px;
} }
&::-webkit-scrollbar-thumb { &::-webkit-scrollbar-thumb {
background: #99a9bf; background: #99a9bf;
border-radius: 20px; border-radius: 20px;
@ -37,21 +39,25 @@
$transparent-border-style: $width solid transparent; $transparent-border-style: $width solid transparent;
height: 0; height: 0;
width: 0; width: 0;
@if $direction==up { @if $direction==up {
border-bottom: $color-border-style; border-bottom: $color-border-style;
border-left: $transparent-border-style; border-left: $transparent-border-style;
border-right: $transparent-border-style; border-right: $transparent-border-style;
} }
@else if $direction==right { @else if $direction==right {
border-left: $color-border-style; border-left: $color-border-style;
border-top: $transparent-border-style; border-top: $transparent-border-style;
border-bottom: $transparent-border-style; border-bottom: $transparent-border-style;
} }
@else if $direction==down { @else if $direction==down {
border-top: $color-border-style; border-top: $color-border-style;
border-left: $transparent-border-style; border-left: $transparent-border-style;
border-right: $transparent-border-style; border-right: $transparent-border-style;
} }
@else if $direction==left { @else if $direction==left {
border-right: $color-border-style; border-right: $color-border-style;
border-top: $transparent-border-style; border-top: $transparent-border-style;

View File

@ -1,15 +1,17 @@
#app { #app {
// 主体区域
// 主体区域 Main container
.main-container { .main-container {
min-height: 100%; min-height: 100%;
transition: margin-left .28s; transition: margin-left .28s;
margin-left: 180px; margin-left: $sideBarWidth;
position: relative; position: relative;
} }
// 侧边栏
// 侧边栏 Sidebar container
.sidebar-container { .sidebar-container {
transition: width 0.28s; transition: width 0.28s;
width: 180px !important; width: $sideBarWidth !important;
height: 100%; height: 100%;
position: fixed; position: fixed;
font-size: 0px; font-size: 0px;
@ -18,62 +20,79 @@
left: 0; left: 0;
z-index: 1001; z-index: 1001;
overflow: hidden; overflow: hidden;
//reset element-ui css //reset element-ui css
.horizontal-collapse-transition { .horizontal-collapse-transition {
transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out; transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out;
} }
.scrollbar-wrapper { .scrollbar-wrapper {
overflow-x: hidden!important; overflow-x: hidden !important;
.el-scrollbar__view { .el-scrollbar__view {
height: 100%; height: 100%;
} }
} }
.el-scrollbar__bar.is-vertical{
.el-scrollbar__bar.is-vertical {
right: 0px; right: 0px;
} }
.is-horizontal { .is-horizontal {
display: none; display: none;
} }
a { a {
display: inline-block; display: inline-block;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
} }
.svg-icon { .svg-icon {
margin-right: 16px; margin-right: 16px;
} }
.el-menu { .el-menu {
border: none; border: none;
height: 100%; height: 100%;
width: 100% !important; width: 100% !important;
} }
.is-active > .el-submenu__title{
color: #f4f4f5!important; .is-active>.el-submenu__title {
color: #f4f4f5 !important;
} }
} }
.hideSidebar { .hideSidebar {
.sidebar-container { .sidebar-container {
width: 36px !important; width: 36px !important;
} }
.main-container { .main-container {
margin-left: 36px; margin-left: 36px;
} }
.submenu-title-noDropdown { .submenu-title-noDropdown {
padding-left: 10px !important; padding-left: 10px !important;
position: relative; position: relative;
.el-tooltip { .el-tooltip {
padding: 0 10px !important; padding: 0 10px !important;
} }
} }
.el-submenu { .el-submenu {
overflow: hidden; overflow: hidden;
&>.el-submenu__title { &>.el-submenu__title {
padding-left: 10px !important; padding-left: 10px !important;
.el-submenu__icon-arrow { .el-submenu__icon-arrow {
display: none; display: none;
} }
} }
} }
.el-menu--collapse { .el-menu--collapse {
.el-submenu { .el-submenu {
&>.el-submenu__title { &>.el-submenu__title {
@ -88,35 +107,42 @@
} }
} }
} }
.sidebar-container .nest-menu .el-submenu>.el-submenu__title, .sidebar-container .nest-menu .el-submenu>.el-submenu__title,
.sidebar-container .el-submenu .el-menu-item { .sidebar-container .el-submenu .el-menu-item {
min-width: 180px !important; min-width: $sideBarWidth !important;
background-color: $subMenuBg !important; background-color: $subMenuBg !important;
&:hover { &:hover {
background-color: $menuHover !important; background-color: $menuHover !important;
} }
} }
.el-menu--collapse .el-menu .el-submenu { .el-menu--collapse .el-menu .el-submenu {
min-width: 180px !important; min-width: $sideBarWidth !important;
} }
//适配移动端 // 适配移动端, Mobile responsive
.mobile { .mobile {
.main-container { .main-container {
margin-left: 0px; margin-left: 0px;
} }
.sidebar-container { .sidebar-container {
transition: transform .28s; transition: transform .28s;
width: 180px !important; width: $sideBarWidth !important;
} }
&.hideSidebar { &.hideSidebar {
.sidebar-container { .sidebar-container {
transition-duration: 0.3s; transition-duration: 0.3s;
transform: translate3d(-180px, 0, 0); transform: translate3d(-$sideBarWidth, 0, 0);
} }
} }
} }
.withoutAnimation { .withoutAnimation {
.main-container, .main-container,
.sidebar-container { .sidebar-container {
transition: none; transition: none;
@ -124,9 +150,9 @@
} }
} }
.el-menu--vertical{ .el-menu--vertical {
& >.el-menu{ &>.el-menu {
.svg-icon{ .svg-icon {
margin-right: 16px; margin-right: 16px;
} }
} }

View File

@ -16,10 +16,12 @@
.fade-transform-enter-active { .fade-transform-enter-active {
transition: all .5s; transition: all .5s;
} }
.fade-transform-enter { .fade-transform-enter {
opacity: 0; opacity: 0;
transform: translateX(-30px); transform: translateX(-30px);
} }
.fade-transform-leave-to { .fade-transform-leave-to {
opacity: 0; opacity: 0;
transform: translateX(30px); transform: translateX(30px);
@ -44,4 +46,3 @@
.breadcrumb-leave-active { .breadcrumb-leave-active {
position: absolute; position: absolute;
} }

View File

@ -1,3 +1,4 @@
// base color
$blue:#324157; $blue:#324157;
$light-blue:#3A71A8; $light-blue:#3A71A8;
$red:#C03639; $red:#C03639;
@ -11,3 +12,4 @@ $panGreen: #30B08F;
$menuBg:#304156; $menuBg:#304156;
$subMenuBg:#1f2d3d; $subMenuBg:#1f2d3d;
$menuHover:#001528; $menuHover:#001528;
$sideBarWidth: 180px;

View File

@ -2,29 +2,53 @@
<div class="app-container"> <div class="app-container">
<switch-roles @change="handleRolesChange" /> <switch-roles @change="handleRolesChange" />
<div :key="key" style="margin-top:30px;"> <div :key="key" style="margin-top:30px;">
<div>
<span v-permission="['admin']" class="permission-alert"> <span v-permission="['admin']" class="permission-alert">
Only Only
<el-tag class="permission-tag" size="small">admin</el-tag> can see this <el-tag class="permission-tag" size="small">admin</el-tag> can see this
</span> </span>
<el-tag v-permission="['admin']" class="permission-sourceCode" type="info">v-permission="['admin']"</el-tag>
</div>
<div>
<span v-permission="['editor']" class="permission-alert"> <span v-permission="['editor']" class="permission-alert">
Only Only
<el-tag class="permission-tag" size="small">editor</el-tag> can see this <el-tag class="permission-tag" size="small">editor</el-tag> can see this
</span> </span>
<el-tag v-permission="['editor']" class="permission-sourceCode" type="info">v-permission="['editor']"</el-tag>
</div>
<div>
<span v-permission="['admin','editor']" class="permission-alert"> <span v-permission="['admin','editor']" class="permission-alert">
Both Both
<el-tag class="permission-tag" size="small">admin</el-tag> and <el-tag class="permission-tag" size="small">admin</el-tag> and
<el-tag class="permission-tag" size="small">editor</el-tag> can see this <el-tag class="permission-tag" size="small">editor</el-tag> can see this
</span> </span>
<el-tag v-permission="['admin','editor']" class="permission-sourceCode" type="info">v-permission="['admin','editor']"</el-tag>
</div>
</div> </div>
<div :key="'checkPermission'+key" style="margin-top:30px;"> <div :key="'checkPermission'+key" style="margin-top:60px;">
<code>In some cases it is not suitable to use v-permission, such as element Tab component which can only be achieved by manually setting the v-if. <code>
{{ $t('permission.tips') }}
<br> e.g. <br> e.g.
</code> </code>
<el-tabs type="border-card" style="width:500px;">
<el-tab-pane v-if="checkPermission(['admin'])" label="Admin">Admin can see this</el-tab-pane> <el-tabs type="border-card" style="width:550px;">
<el-tab-pane v-if="checkPermission(['editor'])" label="Editor">Editor can see this</el-tab-pane> <el-tab-pane v-if="checkPermission(['admin'])" label="Admin">
<el-tab-pane v-if="checkPermission(['admin','editor'])" label="Admin-OR-Editor">Both admin or editor can see this</el-tab-pane> Admin can see this
<el-tag class="permission-sourceCode" type="info">v-if="checkPermission(['admin'])"</el-tag>
</el-tab-pane>
<el-tab-pane v-if="checkPermission(['editor'])" label="Editor">
Editor can see this
<el-tag class="permission-sourceCode" type="info">v-if="checkPermission(['editor'])"</el-tag>
</el-tab-pane>
<el-tab-pane v-if="checkPermission(['admin','editor'])" label="Admin-OR-Editor">
Both admin or editor can see this
<el-tag class="permission-sourceCode" type="info">v-if="checkPermission(['admin','editor'])"</el-tag>
</el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
</div> </div>
@ -57,14 +81,17 @@ export default{
.app-container { .app-container {
/deep/ .permission-alert { /deep/ .permission-alert {
width: 320px; width: 320px;
margin-top: 30px; margin-top: 15px;
background-color: #f0f9eb; background-color: #f0f9eb;
color: #67c23a; color: #67c23a;
padding: 8px 16px; padding: 8px 16px;
border-radius: 4px; border-radius: 4px;
display: block; display: inline-block;
} }
/deep/ .permission-tag{ /deep/ .permission-sourceCode {
margin-left: 15px;
}
/deep/ .permission-tag {
background-color: #ecf5ff; background-color: #ecf5ff;
} }
} }