setChildrenSession.js 566 B

12345678910111213141516
  1. const setChildrenSession = {
  2. install (Vue) {
  3. Vue.prototype.$setChildrenSession = function(options) {
  4. const children = items => {
  5. const childrenList = options.menus.filter(j => items.code == j.parentCode && j.isshow).map(e => children(e));
  6. if (childrenList.length > 0) {
  7. return { ...items, children: childrenList };
  8. }
  9. return { ...items };
  10. };
  11. const list = options.menus.filter(e => e.code == options.iscode).map(e => children(e));
  12. return list[0];
  13. };
  14. }
  15. };
  16. export default setChildrenSession;