-
- Only
- admin can see this
-
-
- Only
- editor can see this
-
-
- Both
- admin and
- editor can see this
-
+
+
+ Only
+ admin can see this
+
+ v-permission="['admin']"
+
+
+
+
+ Only
+ editor can see this
+
+ v-permission="['editor']"
+
+
+
+
+ Both
+ admin and
+ editor can see this
+
+ v-permission="['admin','editor']"
+
-
-
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.
+
+
+ {{ $t('permission.tips') }}
e.g.
-
- Admin can see this
- Editor can see this
- Both admin or editor can see this
+
+
+
+ Admin can see this
+ v-if="checkPermission(['admin'])"
+
+
+
+ Editor can see this
+ v-if="checkPermission(['editor'])"
+
+
+
+ Both admin or editor can see this
+ v-if="checkPermission(['admin','editor'])"
+
@@ -57,14 +81,17 @@ export default{
.app-container {
/deep/ .permission-alert {
width: 320px;
- margin-top: 30px;
+ margin-top: 15px;
background-color: #f0f9eb;
color: #67c23a;
padding: 8px 16px;
border-radius: 4px;
- display: block;
+ display: inline-block;
}
- /deep/ .permission-tag{
+ /deep/ .permission-sourceCode {
+ margin-left: 15px;
+ }
+ /deep/ .permission-tag {
background-color: #ecf5ff;
}
}