嘿我想以10美元的金额添加Strike Through以显示削减金额.请检查以下内容:
<View style={styles.row}>
<View style={styles.inputWrapstotal}>
<Text style={styles.labelcolor}>16.7% Off</Text>
</View>
<View style={styles.inputWrapstotal}>
<Text style={styles.labelamount}>Rs $10</Text>
<Text style={styles.labelamountchange}> 12 </Text>
</View>
</View>
Run Code Online (Sandbox Code Playgroud)
请添加css,以便我可以在两行文本中对齐,在此先感谢.
我有我的表视图.我有posfields通过使用map函数完善显示.但我的问题是当我试图在posfields map函数中映射td时它向我抛出错误"未定义的''标题'".
{
this.POSFields.map(function (posFields, POSFieldsId) {
return (
<tr>
<td className="posheader" key={POSFieldsId} value={posFields.POSFieldsId}
{posFields.POSFields} </td>
<td>
<select className="selectpicker">
<option value="">Select Value</option>
{this.headers.map(function (headers) {
return (
<option key={headers}>{headers}</option>
);
})}
</select>
</td>
</tr>
)
})
}
Run Code Online (Sandbox Code Playgroud) 我是反应的初学者,所以,需要你的帮助。我使用了可折叠的引导导航栏,不知道如何在移动设备上单击链接后使其折叠。本机引导程序属性 collapseOnSelect 不起作用,或者我做错了什么。
const AppBar = () => (
<Navbar collapseOnSelect>
<Navbar.Header>
<Navbar.Brand>
<div className="logo-wrap">
<Link to="define">
<img height='50' src='./../assets/img/logo.png' className="logo"/>
</Link>
</div>
</Navbar.Brand>
<Navbar.Toggle />
</Navbar.Header>
<Navbar.Collapse>
<Nav>
<LinkContainer to="define" className="nav-link"><NavItem eventKey={1}>Home</NavItem></LinkContainer>
<LinkContainer to="about" className="nav-link"><NavItem eventKey={1}>About</NavItem></LinkContainer>
<LinkContainer to="features" className="nav-link"><NavItem eventKey={1}>Features</NavItem></LinkContainer>
<LinkContainer to="pricing" className="nav-link"><NavItem eventKey={1}>Pricing</NavItem></LinkContainer>
<LinkContainer to="areaMap" className="nav-link"><NavItem eventKey={1}>Area Map</NavItem></LinkContainer>
</Nav>
<Nav pullRight>
<LinkContainer to="login" className="nav-link"><NavItem eventKey={2}>Log In</NavItem></LinkContainer>
<LinkContainer to="registration"><NavItem eventKey={2}><Button className="sign-up">Sign Up</Button></NavItem></LinkContainer>
</Nav>
</Navbar.Collapse>
</Navbar>
);
export default AppBar;
Run Code Online (Sandbox Code Playgroud) 例如,我具有这样的组件结构:
<Parent>
<Child_1>
<InnerChild_1 />
</Chidl_1>
<Child_2>
<InnerChild_2 />
</Chidl_2>
</Parent>
Run Code Online (Sandbox Code Playgroud)
<Parent>
连接到Redux的组件。有什么更好的方式来更新<InnerChild_1 />
与应用程序的状态,从发送这个数据<Parent>
与props
或连接<InnerChild_1 />
到终极版?如果连接,我应该将使用状态的所有组件都连接到redux吗?
我有一个引导网格,其中每个网格项都是从一个对象数组中填充的,但是在每个网格项之后我想要一个投票按钮.如何通过单独维护每个按钮上的状态来实现这一点,即当单击按钮1时,文本应从"投票"变为"投票",而其他文本仍为"投票".
点击按钮时,所有这些按钮都变为'Voted'
class Items extends Component {
constructor(props) {
super(props);
this.state = { hasVoted: false };
this.OnClick = this.OnClick.bind(this);
}
OnClick() {
this.setState(prevState => ({
hasVoted: !prevState.hasVoted
}));
}
render() {
const Item = teasers.items.map(item =>
<Col key={item.nid}>
<span>
{itemType}
</span>
<a href={item.path}>
<Image src={item.image.src} title={item.productType} />
<span>
{item.Title}
</span>
<div className={teasersStyle.copy}>
{" "}{item.Copy}>
</div>
</a>
<div
className={this.state.hasVoted ? "active" : "notactive"}
onClick={this.OnClick}
>
{this.state.hasVoted ? "Voted" : "Vote"}
</div>
</Col>
);
return (
<div>
<Grid>
<Row>
{Item}
</Row>
</Grid> …
Run Code Online (Sandbox Code Playgroud) 我在用户点击按钮时显示某个div(实际上是图像)
<img src={notification} className="search_bar_icons" onClick={this.props.open_notifications}/>
Run Code Online (Sandbox Code Playgroud)
当用户点击此图片时,我正在改变我希望显示为"真实"的div的状态
open_notification() {
this.setState({
showNotification: true,
});
}
Run Code Online (Sandbox Code Playgroud)
这是正常的.但是如果用户再次单击图像,我想将状态设置为"false".我怎样才能做到这一点?