text: webpackJsonp([37],{"6O1j":function(e,s,i){var n=i("FY98");"string"==typeof n&&(n=[[e.i,n,""]]),n.locals&&(e.exports=n.locals);i("8bSs")("433940a7",n,!0)},FY98:function(e,s,i){(e.exports=i("BkJT")(!1)).push([e.i,"\n.app-container[data-v-0d0cee04] .permission-alert {\n  width: 320px;\n  margin-top: 30px;\n  background-color: #f0f9eb;\n  color: #67c23a;\n  padding: 8px 16px;\n  border-radius: 4px;\n  display: block;\n}\n.app-container[data-v-0d0cee04] .permission-tag {\n  background-color: #ecf5ff;\n}\n",""])},dy4A:function(e,s,i){"use strict";Object.defineProperty(s,"__esModule",{value:!0});var n=i("IcnI"),t={inserted:function(e,s,i){var t=s.value,a=n.a.getters&&n.a.getters.roles;if(!(t&&t instanceof Array&&t.length>0))throw new Error("need roles! Like v-permission=\"['admin','editor']\"");var r=t;a.some(function(e){return r.includes(e)})||e.parentNode&&e.parentNode.removeChild(e)}},a=function(e){e.directive("permission",t)};window.Vue&&(window.permission=t,Vue.use(a)),t.install=a;var r=t;var o={name:"directivePermission",components:{SwitchRoles:i("v5cR").default},directives:{permission:r},data:function(){return{key:1}},methods:{checkPermission:function(e){if(e&&e instanceof Array&&e.length>0){var s=e;return!!(n.a.getters&&n.a.getters.roles).some(function(e){return s.includes(e)})}return console.error("need roles! Like v-permission=\"['admin','editor']\""),!1},handleRolesChange:function(){this.key++}}},c={render:function(){var e=this,s=e.$createElement,i=e._self._c||s;return i("div",{staticClass:"app-container"},[i("switch-roles",{on:{change:e.handleRolesChange}}),e._v(" "),i("div",{key:e.key,staticStyle:{"margin-top":"30px"}},[i("span",{directives:[{name:"permission",rawName:"v-permission",value:["admin"],expression:"['admin']"}],staticClass:"permission-alert"},[e._v("\n      Only\n      "),i("el-tag",{staticClass:"permission-tag",attrs:{size:"small"}},[e._v("admin")]),e._v(" can see this\n    ")],1),e._v(" "),i("span",{directives:[{name:"permission",rawName:"v-permission",value:["editor"],expression:"['editor']"}],staticClass:"permission-alert"},[e._v("\n      Only\n      "),i("el-tag",{staticClass:"permission-tag",attrs:{size:"small"}},[e._v("editor")]),e._v(" can see this\n    ")],1),e._v(" "),i("span",{directives:[{name:"permission",rawName:"v-permission",value:["admin","editor"],expression:"['admin','editor']"}],staticClass:"permission-alert"},[e._v("\n      Both\n      "),i("el-tag",{staticClass:"permission-tag",attrs:{size:"small"}},[e._v("admin")]),e._v(" and\n      "),i("el-tag",{staticClass:"permission-tag",attrs:{size:"small"}},[e._v("editor")]),e._v(" can see this\n    ")],1)]),e._v(" "),i("div",{key:"checkPermission"+e.key,staticStyle:{"margin-top":"30px"}},[e._m(0),e._v(" "),i("el-tabs",{staticStyle:{width:"500px"},attrs:{type:"border-card"}},[e.checkPermission(["admin"])?i("el-tab-pane",{attrs:{label:"Admin"}},[e._v("Admin can see this")]):e._e(),e._v(" "),e.checkPermission(["editor"])?i("el-tab-pane",{attrs:{label:"Editor"}},[e._v("Editor can see this")]):e._e(),e._v(" "),e.checkPermission(["admin","editor"])?i("el-tab-pane",{attrs:{label:"Admin-OR-Editor"}},[e._v("Both admin or editor can see this")]):e._e()],1)],1)],1)},staticRenderFns:[function(){var e=this.$createElement,s=this._self._c||e;return s("code",[this._v("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.\n      "),s("br"),this._v(" e.g.\n    ")])}]};var l=i("vSla")(o,c,!1,function(e){i("6O1j")},"data-v-0d0cee04",null);s.default=l.exports}});