// this is the default behavior
const getConfirmation = (message, callback) => {
const allowTransition = window.confirm(message)
callback(allowTransition)
}
`
- hashType: string
用于window.location.hash的编码类型。可用值为:
"slash": 创建一个hash值,例如:#/ and #/sunshine/lollipops "noslash": 创建一个hash值,例如:# and #sunshine/lollipops ”hashbang“: 创建一个”ajax crawlable” (已被谷歌弃用) 例如:#!/ and #!/sunshine/lollipops
import { createServer } from 'http'
import React from 'react'
import ReactDOMServer from 'react-dom/server'
import { StaticRouter } from 'react-router'
createServer((req, res) => {
// This context object contains the results of the render
const context = {}
const html = ReactDOMServer.renderToString(
)
// context.url will contain the URL to redirect to if a was usedif (context.url) {
res.writeHead(302, {
Location: context.url
})
res.end()
} else {
res.write(html)
res.end()
}
}).listen(3000)
{/* there will only ever be one child here */}
{/* there will always be two children here,
one might render null though, making transitions
a bit more cumbersome to work out */}
history 对象是可变的。因此,建议从的渲染道具访问位置,而不是从history.location访问。这样可以确保您对于React的假设在生命周期挂钩中是正确的。例如:
`
class Comp extends React.Component {
componentWillReceiveProps(nextProps) {
// will be true
const locationChanged = nextProps.location !== this.props.location
// INCORRECT, will *always* be false because history is mutable.
const locationChanged = nextProps.history.location !== this.props.history.location
}
}
// but you can use a location instead
const location = {
pathname: '/somewhere'
state: { fromDashboard: true }
}
history.push(location)
history.replace(location)
Route component as this.props.match Route render as ({ match }) => () Route children as ({ match }) => () withRouter as this.props.match matchPath as the return value
如果路由没有路径,因此始终匹配,您将获得最接近的父级匹配。与Router一样。
matchPath
这允许您使用除了正常渲染循环之外的使用相同的匹配代码,例如在服务器上渲染之前收集数据依赖关系。
`
import { matchPath } from 'react-router'
const match = matchPath('/users/123', {
path: '/users/:id',
exact: true,
strict: false
})
`
- pathname
第一个参数是要匹配的路径名。如果在Node.js的服务器上使用这个,那么它将是req.url。
- props
第二个参数是匹配的道具,它们与匹配props相同route接受:
`
{
path, // like /users/:id
strict, // optional, defaults to false
exact // optional, defaults to false
}
import React from 'react'
import PropTypes from 'prop-types'
import { withRouter } from 'react-router'
// A simple component that shows the pathname of the current locationclass ShowTheLocation extends React.Component {
static propTypes = {
match: PropTypes.object.isRequired,
location: PropTypes.object.isRequired,
history: PropTypes.object.isRequired
}
render() {
const { match, location, history } = this.props
return (
You are now at {location.pathname}
)
}
}
// Create a new component that is "connected" (to borrow redux
// terminology) to the router.
const ShowTheLocationWithRouter = withRouter(ShowTheLocation)
spring
【控制反转(IOC)/依赖注入(DI)】:
由容器控制程序之间的关系,而非传统实现中,由程序代码直接操控。这也就是所谓“控制反转”的概念所在:控制权由应用代码中转到了外部容器,控制权的转移,是所谓反转。
简单的说:对象的创建又容器(比如spring容器)来执行,程序里不直接new对象。
Web
【单点登录(SSO)】:SSO的定义是在多个应用系统中,用户
Bellman-Ford算法(根据发明者 Richard Bellman 和 Lester Ford 命名)是求解单源最短路径问题的一种算法。单源点的最短路径问题是指:给定一个加权有向图G和源点s,对于图G中的任意一点v,求从s到v的最短路径。有时候这种算法也被称为 Moore-Bellman-Ford 算法,因为 Edward F. Moore zu 也为这个算法的发展做出了贡献。
与迪科
Microsoft .NET Framework 3.5 Service Pack 1(完整软件包)
http://www.microsoft.com/zh-cn/download/details.aspx?id=25150
Microsoft .NET Framework 3.5 Service Pack 1 是一个累积更新,包含很多基于 .NET Framewo
public final class ViewStub extends View
java.lang.Object
android.view.View
android.view.ViewStub
类摘要: ViewStub 是一个隐藏的,不占用内存空间的视图对象,它可以在运行时延迟加载布局资源文件。当 ViewSt