我对React Router有这个简单的配置.我有另一个基本上用...包装,这是有效的.但是这一次没有(当然我试着用不同的实现方式使用像在建议的答复这个职位等等.
控制台错误是这篇文章的标题.使用ES6和react-router v.1与基于散列的路由.
我阅读了很多文章,对于简单的路由实施来说太不必要了,而且现在几乎很讨厌反应和反应路由器.请帮忙.
componentWillReceiveProps() {
this.contextTypes = {
history: React.PropTypes.object
}
},
_handleRoute(e) {
e.preventDefault()
this.history.pushState(null, `/somepath`);
},
render() {
return(
<div onClick={this._handleRoute}>
Some Content.
</div>
);
}
Run Code Online (Sandbox Code Playgroud)
要么:
render() {
return(
<div>
<Link to={`/somepath`}> link </Link>
</div>
);
}
Run Code Online (Sandbox Code Playgroud) 我从设备获取图像并使用 Pixi JS 绘制带有过滤器的画布。使用计算机获取图像效果很好。但是当我在 IOS 上时,它会抛出错误,例如跨源问题,或者我正在尝试使用未知格式。
这是我用来绘制图像的代码(适用于网络/桌面,但不适用于cordova构建的ios应用程序)
_renderImage() {
let wWidth;
if (window.outerWidth > 414) {
wWidth = 414;
} else {
wWidth = window.outerWidth;
}
const img = new Image();
img.src = this.state.avatarSource;
let lower;
if (img.width > img.height) {
lower = img.height;
} else {
lower = img.width;
}
const canvas = this.refs.canvasimg;
if (canvas.hasChildNodes()) {
canvas.removeChild(canvas.childNodes[0]);
}
const renderer = PIXI.autoDetectRenderer(wWidth, wWidth * 1.25, {transparent: true});
const stage = new PIXI.Container();
canvas.appendChild(renderer.view);
// create a PIXI sprite …Run Code Online (Sandbox Code Playgroud) 我在克隆的Grails应用程序位于本地的存储库中.我运行此命令来运行它说:
FAILURE: Build failed with an exception.
* What went wrong:
Task 'bootRun' not found in root project 'vagnkort'.
* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or
--debug option to get more log output.
Run Code Online (Sandbox Code Playgroud)
当我写ls时,我的列表是:
README.md build grails-app grailsw.bat web-app
application.properties docs grailsw src wrapper
Run Code Online (Sandbox Code Playgroud) 我有一个数组:
people = [
{
name: "Kyle",
_id: "2"
},
{
name: Susan,
_id: "1"
}
]
Run Code Online (Sandbox Code Playgroud)
我有一个映射列表:
return (
<ul>
{people.map( (person) => {
return (
<li>
<span>{person.name}</span>
<span>{person.id}</span>
</li>
)
})}
</ul>
)
Run Code Online (Sandbox Code Playgroud)
这一切都运作良好,但我如何根据"名称"对它们进行排序?我试图使用[_.sortBy][1]但无法弄清楚它如何适合React和map函数的上下文.使用lodash或下划线的_.sortBy将不胜感激.
谢谢!
javascript ×3
reactjs ×2
arrays ×1
canvas ×1
cordova ×1
grails ×1
html5-canvas ×1
lodash ×1
pixi.js ×1
react-router ×1
sorting ×1
url-routing ×1