this.props
在React中,可以通过this.props来传递参数,看下面的例子:
```javascript
var OuterComponent = React.createClass({
render: function(){
return (
This is a message
first message
second message
继续阅读 »
这是一个系列文章,主要分享shell(部分功能仅适用于bash)的使用建议和技巧,每次分享3点,希望你能有所收获。
另外,这些建议和技巧都是我工作中用到的,只有我用到了才会记录并分享出来,所以没有什么顺序而言,用到什么我就分享什么。
1 sed替换文件内容
$ cat demo
this is demo
$ sed -i s/demo/test/g demo
$ cat demo
this is test
通过sed,可以很方便替换文件中的某些字符串。比如这里的demo文件只有一行内容:this is demo。通过sed将文件中的demo字符串替换成test。这里的-i选项是直接修改文件内容,字母s表示替换字符,字母g继续阅读 »
直接写
js
function imgError(image) {
image.onerror = null; // prevent event bubble
image.src = "/images/noimage.gif";
return true;
}
html
使用 jQuery
```js
$("img").error(function () {
$(this).unbind("error").attr("src", "broken.gif");
});
//If you use this technique you can use the "one" method to av继续阅读 »