text: (window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-c72e"],{LG6A:function(e,t,s){"use strict";var r=s("e3e0");s.n(r).a},e3e0:function(e,t,s){},lAbF:function(e,t,s){"use strict";s.r(t);var r=s("QbLZ"),a=s.n(r),i=s("L2JU"),n=s("Q2AE");var o={name:"Dashboard",computed:a()({},Object(i.b)(["name","roles"]),{showRouter:function(){return console.log("全部路由信息",this.$store.getters.routerList),this.$store.getters.routerList.length>0?this.$store.getters.routerList[3].name:""}}),methods:{toggleUser:function(){var e=this;"editor"===this.name?this.$store.dispatch("Login",{username:"admin",password:""}).then(function(){location.reload()}).catch(function(){e.$message("接口出现了一些问题....")}):this.$store.dispatch("Login",{username:"editor",password:""}).then(function(){location.reload()}).catch(function(){e.$message("接口出现了一些问题....")})},basePermit:function(e){return function(e){return n.a.getters.roles.includes(e)}(e)}}},v=(s("LG6A"),s("KHd+")),_=Object(v.a)(o,function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"dashboard-container"},[s("div",{staticClass:"dashboard-text"},[e._v("name:"+e._s(e.name))]),e._v(" "),s("div",{staticClass:"dashboard-text"},[e._v("roles:"+e._s(e.roles))]),e._v(" "),s("h2",[e._v("关于路由")]),e._v(" "),s("div",[e._v(e._s(e.name)+" 的路由为 "+e._s(e.showRouter))]),e._v(" "),s("div",[e._v("未解析路由信息请看NetWork的,解析完成的路由信息请看控制台")]),e._v(" "),s("h2",[e._v("关于权限")]),e._v(" "),s("p",[e._v("这里做了简单的权限区分,")]),e._v(" "),s("p",[e._v('\n    admin 用户存在 "增加", "删除", "修改", "查看" 权限\n    ,所以根据自定义指令管理员可以操作的按钮都会被渲染出来\n  ')]),e._v(" "),s("p",[e._v('\n    editor 用户 只存在 "修改", "查看" ,所以自定义指令不会渲染 增加 与 删除\n  ')]),e._v(" "),s("h3",[e._v("自定义指令的实现")]),e._v(" "),s("el-button",{directives:[{name:"permit",rawName:"v-permit",value:"add",expression:"'add'"}],attrs:{type:"primary"}},[e._v("增加")]),e._v(" "),s("el-button",{directives:[{name:"permit",rawName:"v-permit",value:"delete",expression:"'delete'"}],attrs:{type:"danger"}},[e._v("删除")]),e._v(" "),s("el-button",{directives:[{name:"permit",rawName:"v-permit",value:"edit",expression:"'edit'"}],attrs:{type:"warning"}},[e._v("修改")]),e._v(" "),s("el-button",{directives:[{name:"permit",rawName:"v-permit",value:"view",expression:"'view'"}],attrs:{type:"success"}},[e._v("查看")]),e._v(" "),s("h3",[e._v("v-if的实现")]),e._v(" "),e.basePermit("add")?s("el-button",{attrs:{type:"primary"}},[e._v("增加")]):e._e(),e._v(" "),e.basePermit("delete")?s("el-button",{attrs:{type:"danger"}},[e._v("删除")]):e._e(),e._v(" "),e.basePermit("edit")?s("el-button",{attrs:{type:"warning"}},[e._v("修改")]):e._e(),e._v(" "),e.basePermit("view")?s("el-button",{attrs:{type:"success"}},[e._v("查看")]):e._e(),e._v(" "),s("div",{staticClass:"toggle"},[s("el-button",{attrs:{size:"small",type:"primary"},on:{click:e.toggleUser}},[e._v("切换用户")])],1)],1)},[],!1,null,"2a03a637",null);_.options.__file="index.vue";t.default=_.exports}}]);