我是新手做出反应,我正在尝试链接另一个页面,如果条件为真 我的代码就像这样
<template match="/shiporder/shipto" xmlns="http://www.w3.org/1999/XSL/Transform">
<Line1 xmlns="">
<apply-templates select="city" xmlns="http://www.w3.org/1999/XSL/Transform" />
</Line1>
</template>
<xsl:template match="/shiporder/shipto" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<Line1>
<xsl:apply-templates select="city" />
</Line1>
</template>
<weird:template match="/shiporder/shipto" xmlns:weird="http://www.w3.org/1999/XSL/Transform">
<Line1>
<weird:apply-templates select="city" />
</Line1>
</template>
这是连接到此链接的按钮。
checkCred(){
for(var i=0; i < details_array.length; i++){
var currentObject = details_array[i];
if (this.email.value === currentObject.username){
console.log('yes done it');
// link to another component named as Index. if the above statement is true then only
//
}
else{
//Sorry your credentials were wrong
}
}
}
当我使用react-router时,我不知道如何连接到另一个页面。它没有检查条件直接进入另一页。
答案 0 :(得分:0)
这样的问题可以通过{withRouter}来解决 代码看起来像这样。
for(var i=0; i < details_array.length; i++){
var currentObject = details_array[i];
if (this.email.value == currentObject.username && this.password.value == currentObject.password){
console.log('yes done it');
this.props.router.push('Index');
}
我希望这对每个人都有帮助!!!
由于