使用React [15.6.1] Redux [3.7.2]和Router [4.1.1]我正在尝试访问一种方法,该方法属于其他(同级)组件,但似乎无法访问它们。反正有出口这些方法吗?
----------
¦ Parent ¦
----------
¦
-------------------------------
¦ ¦ ¦
----------- ----------- -----------
¦ Child 1 ¦ ¦ Child 2 ¦ ¦ Child 3 ¦
----------- ----------- -----------
// Child 1 has a method submitChild1()
// Child 2 has a method submitChild2()
// Child 3 has to access both of those methods
class Parent1 extends React.Component {
render() {
return (
<div>
<Child1 />
<Child2 />
<Child3 />
</div>
);
}
}
class Child1 extends …Run Code Online (Sandbox Code Playgroud) 我有一个小图库,有一个搜索框,当用户点击图像时,它会打开一个带有相同图像的灯箱.
基本上我将$ index传递给一个函数,该函数在$ scope.list [lb.index]中打开该项.
我的代码:
HTML
<input type="text" ng-model="query.name" />
<ul class="list" ng-show="list.length>0">
<li ng-repeat="item in list | filter:query">
<a class="img" ng-style="{'background-image':'url(/uploads/<%item.image%>)'}" ng-click="openLB($index)"></a>
</li>
</ul>
<div class="lightbox" ng-if="lb.show">
<a class="prev" ng-show="list.length>1" ng-click="changeItemLB(lb.index, 'prev')"></a>
<a class="next" ng-show="list.length>1" ng-click="changeItemLB(lb.index, 'next')"></a>
<div class="holder">
<img ng-if="list[lb.index].image.length" ng-src="/uploads/<%list[lb.index].image%>" />
</div>
</div>
Angular
$scope.openLB = function(index) {
$scope.lb.show = true;
$scope.lb.index = index;
};
$scope.changeItemLB = function(index, action) {
var tot = $scope.list.length-1,
goto = 0;
if(action=='prev') goto = index==0 ? …Run Code Online (Sandbox Code Playgroud) 任何人都可以向我解释如果我们在session_name中使用点(.),浏览器会丢失会话吗?
例:
session_name('abc'); // works
session_name('a.bc'); // doesn't work
Run Code Online (Sandbox Code Playgroud) 我想知道是否可以添加使用反应日期选择的最大天数。基本上是已经存在的minimumNights属性的倒数。
干杯
如何使用特殊字符进行indexOf Case Insensite?我需要搜索"benefícios"这个词,我希望IndexOf找到它,即使我不使用"i"上的特殊字符
这样我就找不到了:
string str = "candidatar-se a benefícios";
string word = "beneficio";
str.IndexOf(word, StringComparison.OrdinalIgnoreCase)
Run Code Online (Sandbox Code Playgroud)
但有了这个,我可以:
string str = "candidatar-se a benefícios exclusivos";
string word = "benefício";
str.IndexOf(word, StringComparison.OrdinalIgnoreCase)
Run Code Online (Sandbox Code Playgroud)
谢谢