【发布时间】:2019-02-27 18:33:36
【问题描述】:
我是 react-redux. 的新手所以,我有以下标记
<div className="questionLevelIndication">
<span className="levelIndicatorBtn backgroundColorForLow">
1
</span>
<label className="levelIndicationLabel">
Low Maximum 6
</label>
</div>
<div className="row topMargn">
<div className="questionRow">
<div className="rowContent borderRight text-center ">1</div>
<div className="rowContent fontStyle borderRight">
<label type="text">Select from </label>
<select value="" className="selectpicker btn btn-labeled btn-start selectId techDrop margin-left-10">
<option value="">None Selected</option>
<option value="">Abc </option>
<option value="">PQR </option>
</select>
</div>
<div className="rowContent borderRight">
<div className="fontStyle">
<span>Select Questions Type</span>
<button type="button" className="btn btn-primary btn-sm margin-left-10 typeBtn">some Type</button>
<button type="button" className="btn btn-secondary btn-sm margin-left-10 typeBtn">Nothing Type</button>
</div>
</div>
<div className="rowContent">
<div className="fontStyle">
Number Of Questions
<select value="" className="numberDropdown selectpicker btn btn-labeled btn-start selectId quesSDrop margin-left-10">
<option value="">01</option>
<option value="">02</option>
</select>
</div>
</div>
</div>
<div className="rowContent">
<span className="">
<button type="button" className="btn btn-outline-primary btn-sm standard-btn-50">Reset</button>
</span>
<span>
<button type="button" className="btn btn-primary btn-sm standard-btn-50 margin-left-10">+</button>
</span>
</div>
</div>
这里是三种类型的字段:
1.低
2.中等
3.硬
对于每个字段,都会有相同的 HTML 结构。
所以,我三次使用了相同的代码。每个类别中都有一个加号按钮,现在,单击此按钮后,尊重的行将为第一个用户复制一次,最多 6 行。
因此,中等难度和难度也是如此。我有几个问题,例如:
1.我怎样才能只有一个html结构可以呈现三个类别?
如果用户点击加号按钮,那么如何在更改 ID 的第一行之后添加该行?
如何获取每个添加的新行的值以及前一行的值?
如果用户已删除该行,那么我该如何删除该行?
我应该在哪里添加滚动条,因为最多可以添加 20 行?
谁能给我任何提示?会很有帮助的。
【问题讨论】:
-
使用map渲染多个元素和状态变量来维护每种类型的行数
标签: javascript html reactjs redux