mirror of
https://github.com/zuiidea/antd-admin
synced 2026-10-28 03:04:48 +00:00
code style
This commit is contained in:
@@ -16,7 +16,7 @@ const enterAnim = [
|
||||
ease: 'easeOutQuad',
|
||||
onComplete: (e) => {
|
||||
e.target.style.height = 'auto'
|
||||
},
|
||||
}
|
||||
}, {
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
@@ -41,19 +41,18 @@ const leaveAnim = [
|
||||
]
|
||||
|
||||
const TableBodyWrapper = ({ body, page = 1, current }) => {
|
||||
|
||||
// 切换分页去除动画;
|
||||
if(current != +page) {
|
||||
if (current !== +page) {
|
||||
return body
|
||||
}
|
||||
|
||||
return (
|
||||
<TweenOneGroup
|
||||
component="tbody"
|
||||
className={body.props.className}
|
||||
enter={enterAnim}
|
||||
leave={leaveAnim}
|
||||
appear={false}>
|
||||
component='tbody'
|
||||
className={body.props.className}
|
||||
enter={enterAnim}
|
||||
leave={leaveAnim}
|
||||
appear={false}>
|
||||
{body.props.children}
|
||||
</TweenOneGroup>
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ import TableBodyWrapper from '../common/TableBodyWrapper'
|
||||
|
||||
const confirm = Modal.confirm
|
||||
|
||||
function list({
|
||||
function list ({
|
||||
loading,
|
||||
dataSource,
|
||||
pagination,
|
||||
@@ -17,7 +17,6 @@ function list({
|
||||
onStatusItem,
|
||||
location
|
||||
}) {
|
||||
|
||||
const handleMenuClick = (record, e) => {
|
||||
if (e.key === '1') {
|
||||
onEditItem(record)
|
||||
@@ -80,16 +79,16 @@ function list({
|
||||
key: 'operation',
|
||||
width: 100,
|
||||
render: (text, record) => {
|
||||
return (<Dropdown overlay={<Menu onClick={(e) => handleMenuClick(record, e)}>
|
||||
<Menu.Item key='1'>编辑</Menu.Item>
|
||||
<Menu.Item key='2'>删除</Menu.Item>
|
||||
</Menu>}>
|
||||
<Button style={{ border: 'none' }}>
|
||||
<Icon style={{ marginRight: 2 }} type='bars' />
|
||||
<Icon type='down' />
|
||||
</Button>
|
||||
</Dropdown>)
|
||||
}
|
||||
return (<Dropdown overlay={<Menu onClick={(e) => handleMenuClick(record, e)}>
|
||||
<Menu.Item key='1'>编辑</Menu.Item>
|
||||
<Menu.Item key='2'>删除</Menu.Item>
|
||||
</Menu>}>
|
||||
<Button style={{ border: 'none' }}>
|
||||
<Icon style={{ marginRight: 2 }} type='bars' />
|
||||
<Icon type='down' />
|
||||
</Button>
|
||||
</Dropdown>)
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ import { browserHistory } from 'dva/router'
|
||||
// 1. Initialize
|
||||
const app = dva({
|
||||
history: browserHistory,
|
||||
onError(error) {
|
||||
console.error("app onError -- ", error)
|
||||
onError (error) {
|
||||
console.error('app onError -- ', error)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
+3
-2
@@ -2,8 +2,8 @@ import React from 'react'
|
||||
import {Router} from 'dva/router'
|
||||
import App from './routes/app'
|
||||
|
||||
const cached = {};
|
||||
function registerModel(app, model) {
|
||||
const cached = {}
|
||||
const registerModel = (app, model) => {
|
||||
if (!cached[model.namespace]) {
|
||||
app.model(model)
|
||||
cached[model.namespace] = 1
|
||||
@@ -17,6 +17,7 @@ export default function ({history, app}) {
|
||||
component: App,
|
||||
getIndexRoute (nextState, cb) {
|
||||
require.ensure([], require => {
|
||||
registerModel(app, require('./models/dashboard'))
|
||||
cb(null, {component: require('./routes/dashboard')})
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user