Skip to content

Commit

Permalink
refactor(Navbar): 解决开发时 reload 之后被原有样式覆盖
Browse files Browse the repository at this point in the history
  • Loading branch information
twinh committed May 21, 2021
1 parent 9e06862 commit 1a411dc
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions components/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import $ from 'miaoxing';
import {Layout, Avatar, Menu, Dropdown} from 'antd';
import {DownOutlined} from '@ant-design/icons';
import {Link} from '@mxjs/router';
import {Box} from '@mxjs/box';
import {Actions} from '@mxjs/actions';
import {floatRight} from '@mxjs/css';
import {css, floatRight} from '@mxjs/css';
import {LockOutlined, LogoutOutlined} from '@ant-design/icons';
import propTypes from 'prop-types';

Expand All @@ -18,27 +17,26 @@ export default class extends React.Component {

static propTypes = {
user: propTypes.object,
}
};

handleLogout = async () => {
const ret = await api.post('logout');
await $.ret(ret);
if (ret.isSuc()) {
history.push($.url('admin/login', {next: window.location.pathname}));
}
}
};

render() {
const {user} = this.props;

return (
<Box
as={Layout.Header}
bg="white"
sx={{
<Layout.Header
css={css({
bg: 'white !important', /* 开发时,避免 reload 之后被原有样式覆盖 */
boxShadow: 'sm',
zIndex: 1,
}}
})}
>
<Dropdown
css={floatRight()}
Expand Down Expand Up @@ -67,7 +65,7 @@ export default class extends React.Component {
</Actions>
</a>
</Dropdown>
</Box>
</Layout.Header>
);
}
}

0 comments on commit 1a411dc

Please sign in to comment.