@ccs-design/rc-pro
Version:
ccs design basic react component
30 lines (26 loc) • 759 B
JavaScript
import React from 'react';
import Switch from './switch';
import { AuthContext } from './context';
var AppPage = function AppPage(_ref) {
var location = _ref.location,
children = _ref.children,
menu = _ref.menu;
/** 权限判断 */
var onAuth = function onAuth(code) {
var btns = (menu === null || menu === void 0 ? void 0 : menu.children) || [];
return btns.find(function (b) {
return b.nodeData.menuUrl === code;
});
};
return /*#__PURE__*/React.createElement(AuthContext.Provider, {
value: {
menu: menu,
onAuth: onAuth
}
}, /*#__PURE__*/React.createElement(Switch, {
location: location
}, children));
};
export default /*#__PURE__*/React.memo(AppPage, function () {
return true;
});