travel/admin/node_modules/.cache/babel-loader/2de492c42b8b4667c31488c86e7...

1 line
3.9 KiB
JSON

{"remainingRequest":"D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\babel-loader\\lib\\index.js!D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\eslint-loader\\index.js??ref--13-0!D:\\phpstudy_pro\\WWW\\travel\\admin\\src\\directive\\permission\\permission.js","dependencies":[{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\src\\directive\\permission\\permission.js","mtime":1718070786011},{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\babel.config.js","mtime":1718070785981},{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\cache-loader\\dist\\cjs.js","mtime":1718764957200},{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\babel-loader\\lib\\index.js","mtime":1718764959024},{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\eslint-loader\\index.js","mtime":1718764957746}],"contextDependencies":[],"result":[{"type":"Buffer","data":"base64:aW1wb3J0ICJjb3JlLWpzL21vZHVsZXMvZXMuYXJyYXkuaW5jbHVkZXMuanMiOwppbXBvcnQgImNvcmUtanMvbW9kdWxlcy9lcy5vYmplY3QudG8tc3RyaW5nLmpzIjsKaW1wb3J0ICJjb3JlLWpzL21vZHVsZXMvZXMuc3RyaW5nLmluY2x1ZGVzLmpzIjsKaW1wb3J0IHN0b3JlIGZyb20gJ0Avc3RvcmUnOwpmdW5jdGlvbiBjaGVja1Blcm1pc3Npb24oZWwsIGJpbmRpbmcpIHsKICB2YXIgdmFsdWUgPSBiaW5kaW5nLnZhbHVlOwogIHZhciByb2xlcyA9IHN0b3JlLmdldHRlcnMgJiYgc3RvcmUuZ2V0dGVycy5yb2xlczsKICBpZiAodmFsdWUgJiYgdmFsdWUgaW5zdGFuY2VvZiBBcnJheSkgewogICAgaWYgKHZhbHVlLmxlbmd0aCA+IDApIHsKICAgICAgdmFyIHBlcm1pc3Npb25Sb2xlcyA9IHZhbHVlOwogICAgICB2YXIgaGFzUGVybWlzc2lvbiA9IHJvbGVzLnNvbWUoZnVuY3Rpb24gKHJvbGUpIHsKICAgICAgICByZXR1cm4gcGVybWlzc2lvblJvbGVzLmluY2x1ZGVzKHJvbGUpOwogICAgICB9KTsKICAgICAgaWYgKCFoYXNQZXJtaXNzaW9uKSB7CiAgICAgICAgZWwucGFyZW50Tm9kZSAmJiBlbC5wYXJlbnROb2RlLnJlbW92ZUNoaWxkKGVsKTsKICAgICAgfQogICAgfQogIH0gZWxzZSB7CiAgICB0aHJvdyBuZXcgRXJyb3IoIm5lZWQgcm9sZXMhIExpa2Ugdi1wZXJtaXNzaW9uPVwiWydhZG1pbicsJ2VkaXRvciddXCIiKTsKICB9Cn0KZXhwb3J0IGRlZmF1bHQgewogIGluc2VydGVkOiBmdW5jdGlvbiBpbnNlcnRlZChlbCwgYmluZGluZykgewogICAgY2hlY2tQZXJtaXNzaW9uKGVsLCBiaW5kaW5nKTsKICB9LAogIHVwZGF0ZTogZnVuY3Rpb24gdXBkYXRlKGVsLCBiaW5kaW5nKSB7CiAgICBjaGVja1Blcm1pc3Npb24oZWwsIGJpbmRpbmcpOwogIH0KfTs="},{"version":3,"names":["store","checkPermission","el","binding","value","roles","getters","Array","length","permissionRoles","hasPermission","some","role","includes","parentNode","removeChild","Error","inserted","update"],"sources":["D:/phpstudy_pro/WWW/travel/admin/src/directive/permission/permission.js"],"sourcesContent":["import store from '@/store'\r\n\r\nfunction checkPermission(el, binding) {\r\n const { value } = binding\r\n const roles = store.getters && store.getters.roles\r\n\r\n if (value && value instanceof Array) {\r\n if (value.length > 0) {\r\n const permissionRoles = value\r\n\r\n const hasPermission = roles.some(role => {\r\n return permissionRoles.includes(role)\r\n })\r\n\r\n if (!hasPermission) {\r\n el.parentNode && el.parentNode.removeChild(el)\r\n }\r\n }\r\n } else {\r\n throw new Error(`need roles! Like v-permission=\"['admin','editor']\"`)\r\n }\r\n}\r\n\r\nexport default {\r\n inserted(el, binding) {\r\n checkPermission(el, binding)\r\n },\r\n update(el, binding) {\r\n checkPermission(el, binding)\r\n }\r\n}\r\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,SAAS;AAE3B,SAASC,eAAeA,CAACC,EAAE,EAAEC,OAAO,EAAE;EACpC,IAAQC,KAAK,GAAKD,OAAO,CAAjBC,KAAK;EACb,IAAMC,KAAK,GAAGL,KAAK,CAACM,OAAO,IAAIN,KAAK,CAACM,OAAO,CAACD,KAAK;EAElD,IAAID,KAAK,IAAIA,KAAK,YAAYG,KAAK,EAAE;IACnC,IAAIH,KAAK,CAACI,MAAM,GAAG,CAAC,EAAE;MACpB,IAAMC,eAAe,GAAGL,KAAK;MAE7B,IAAMM,aAAa,GAAGL,KAAK,CAACM,IAAI,CAAC,UAAAC,IAAI,EAAI;QACvC,OAAOH,eAAe,CAACI,QAAQ,CAACD,IAAI,CAAC;MACvC,CAAC,CAAC;MAEF,IAAI,CAACF,aAAa,EAAE;QAClBR,EAAE,CAACY,UAAU,IAAIZ,EAAE,CAACY,UAAU,CAACC,WAAW,CAACb,EAAE,CAAC;MAChD;IACF;EACF,CAAC,MAAM;IACL,MAAM,IAAIc,KAAK,uDAAqD,CAAC;EACvE;AACF;AAEA,eAAe;EACbC,QAAQ,WAAAA,SAACf,EAAE,EAAEC,OAAO,EAAE;IACpBF,eAAe,CAACC,EAAE,EAAEC,OAAO,CAAC;EAC9B,CAAC;EACDe,MAAM,WAAAA,OAAChB,EAAE,EAAEC,OAAO,EAAE;IAClBF,eAAe,CAACC,EAAE,EAAEC,OAAO,CAAC;EAC9B;AACF,CAAC","ignoreList":[]}]}