Skip to content

Commit

Permalink
fix: fixedHeader not work state
Browse files Browse the repository at this point in the history
  • Loading branch information
sendya committed Mar 11, 2021
1 parent 727b17f commit cdfcebd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 2 additions & 5 deletions examples/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const BasicLayout = defineComponent({
const [RouteContextProvider] = createRouteContext();

const menuData = getMenuData(getRoutes());
globalState.menuData = menuData;
state.menuData = menuData;

const updateSelectedMenu = () => {
const matched = route.matched.concat().map(item => item.path);
Expand Down Expand Up @@ -65,12 +65,9 @@ const BasicLayout = defineComponent({
return () => (
<RouteContextProvider value={state}>
<ProLayout
i18n={(key: string) => key}
layout={state.layout}
navTheme={state.navTheme}
i18n={(key: string) => key}
isMobile={state.isMobile}
fixSiderbar={state.fixSiderbar}
fixedHeader={state.fixedHeader}
contentWidth={'Fixed'}
primaryColor={'#1890ff'}
contentStyle={{ minHeight: '300px' }}
Expand Down
4 changes: 3 additions & 1 deletion src/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ export const HeaderView = defineComponent({
onCollapse,
} = toRefs(props);
const context = useRouteContext();
const needFixedHeader = computed(() => fixedHeader.value || layout.value === 'mix');
const needFixedHeader = computed(
() => fixedHeader.value || context.fixedHeader || layout.value === 'mix',
);
const isTop = computed(() => layout.value === 'top');
const needSettingWidth = computed(
() => needFixedHeader.value && hasSiderMenu.value && !isTop.value && !isMobile.value,
Expand Down

0 comments on commit cdfcebd

Please sign in to comment.