text: (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-34789b1a"],{"8ee8":function(e,s,i){"use strict";var t=function(){var e=this,s=e.$createElement,i=e._self._c||s;return i("div",[i("div",{staticStyle:{"margin-bottom":"15px"}},[e._v(" "+e._s(e.$t("permission.roles"))+": "+e._s(e.roles)+" ")]),e._v(" "+e._s(e.$t("permission.switchRoles"))+": "),i("el-radio-group",{model:{value:e.switchRoles,callback:function(s){e.switchRoles=s},expression:"switchRoles"}},[i("el-radio-button",{attrs:{label:"editor"}}),i("el-radio-button",{attrs:{label:"admin"}})],1)],1)},a=[],n={computed:{roles:function(){return this.$store.getters.roles},switchRoles:{get:function(){return this.roles[0]},set:function(e){var s=this;this.$store.dispatch("user/changeRoles",e).then((function(){s.$emit("change")}))}}}},r=n,o=i("2877"),l=Object(o["a"])(r,t,a,!1,null,null,null);s["a"]=l.exports},a99f:function(e,s,i){"use strict";i.r(s);var t=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}}),i("div",{key:e.key,staticStyle:{"margin-top":"30px"}},[i("div",[i("span",{directives:[{name:"permission",rawName:"v-permission",value:["admin"],expression:"['admin']"}],staticClass:"permission-alert"},[e._v(" Only "),i("el-tag",{staticClass:"permission-tag",attrs:{size:"small"}},[e._v("admin")]),e._v(" can see this ")],1),i("el-tag",{directives:[{name:"permission",rawName:"v-permission",value:["admin"],expression:"['admin']"}],staticClass:"permission-sourceCode",attrs:{type:"info"}},[e._v(" v-permission=\"['admin']\" ")])],1),i("div",[i("span",{directives:[{name:"permission",rawName:"v-permission",value:["editor"],expression:"['editor']"}],staticClass:"permission-alert"},[e._v(" Only "),i("el-tag",{staticClass:"permission-tag",attrs:{size:"small"}},[e._v("editor")]),e._v(" can see this ")],1),i("el-tag",{directives:[{name:"permission",rawName:"v-permission",value:["editor"],expression:"['editor']"}],staticClass:"permission-sourceCode",attrs:{type:"info"}},[e._v(" v-permission=\"['editor']\" ")])],1),i("div",[i("span",{directives:[{name:"permission",rawName:"v-permission",value:["admin","editor"],expression:"['admin','editor']"}],staticClass:"permission-alert"},[e._v(" Both "),i("el-tag",{staticClass:"permission-tag",attrs:{size:"small"}},[e._v("admin")]),e._v(" and "),i("el-tag",{staticClass:"permission-tag",attrs:{size:"small"}},[e._v("editor")]),e._v(" can see this ")],1),i("el-tag",{directives:[{name:"permission",rawName:"v-permission",value:["admin","editor"],expression:"['admin','editor']"}],staticClass:"permission-sourceCode",attrs:{type:"info"}},[e._v(" v-permission=\"['admin','editor']\" ")])],1)]),i("div",{key:"checkPermission"+e.key,staticStyle:{"margin-top":"60px"}},[i("aside",[e._v(" "+e._s(e.$t("permission.tips"))+" "),i("br"),e._v(" e.g. ")]),i("el-tabs",{staticStyle:{width:"550px"},attrs:{type:"border-card"}},[e.checkPermission(["admin"])?i("el-tab-pane",{attrs:{label:"Admin"}},[e._v(" Admin can see this "),i("el-tag",{staticClass:"permission-sourceCode",attrs:{type:"info"}},[e._v(" v-if=\"checkPermission(['admin'])\" ")])],1):e._e(),e.checkPermission(["editor"])?i("el-tab-pane",{attrs:{label:"Editor"}},[e._v(" Editor can see this "),i("el-tag",{staticClass:"permission-sourceCode",attrs:{type:"info"}},[e._v(" v-if=\"checkPermission(['editor'])\" ")])],1):e._e(),e.checkPermission(["admin","editor"])?i("el-tab-pane",{attrs:{label:"Admin-OR-Editor"}},[e._v(" Both admin or editor can see this "),i("el-tag",{staticClass:"permission-sourceCode",attrs:{type:"info"}},[e._v(" v-if=\"checkPermission(['admin','editor'])\" ")])],1):e._e()],1)],1)],1)},a=[],n=(i("d3b7"),i("caad"),i("2532"),i("4360"));function r(e,s){var i=s.value,t=n["a"].getters&&n["a"].getters.roles;if(!(i&&i instanceof Array))throw new Error("need roles! Like v-permission=\"['admin','editor']\"");if(i.length>0){var a=i,r=t.some((function(e){return a.includes(e)}));r||e.parentNode&&e.parentNode.removeChild(e)}}var o={inserted:function(e,s){r(e,s)},update:function(e,s){r(e,s)}},l=function(e){e.directive("permission",o)};window.Vue&&(window["permission"]=o,Vue.use(l)),o.install=l;var c=o;function d(e){if(e&&e instanceof Array&&e.length>0){var s=n["a"].getters&&n["a"].getters.roles,i=e,t=s.some((function(e){return i.includes(e)}));return t}return console.error("need roles! Like v-permission=\"['admin','editor']\""),!1}var m=i("8ee8"),p={name:"DirectivePermission",components:{SwitchRoles:m["a"]},directives:{permission:c},data:function(){return{key:1}},methods:{checkPermission:d,handleRolesChange:function(){this.key++}}},v=p,u=(i("afdd"),i("2877")),h=Object(u["a"])(v,t,a,!1,null,"2c6b2aa6",null);s["default"]=h.exports},afdd:function(e,s,i){"use strict";i("f184")},f184:function(e,s,i){}}]);