class App extends Component {
constructor(props){
super(props);
this.state = {
key: myUUID,
title: "",
author: "",
questions: [],
answers: []
}
}
handleChange = (event) => {
const target = event.target;
const value = target.type === "checkbox" ? target.checked : target.value;
const name = target.name;
this.setState({
[name]: value
});
}
好吧,所以我试图做到这一点,以便当用户在此输入<input type="text" value={this.state.title} onChange={this.handleChange}/>
中输入内容时,其“值”将更新为用户所输入的内容。当前,当我在输入框中键入内容时,我输入的字符不会显示,并且此输入的状态(标题)似乎没有更新。我是React和JS的新手,所以对所发生的事情的任何提示/指针/解释将不胜感激。谢谢!
更新:这是render方法(其中不止如此,所以我进行了合并)
render () {
//yada yada
<div>
<form>
<div className="Intro">
Give your Quiz a title: <input type="text" value={this.state.title} onChange={this.handleChange}/><br/>
Who's the Author? <input type="text" /><br/><br/>
</div>
<div className="questions">
Now let's add some questions... <br/>
{this.addQuestion}
</div>
</form>
<button onClick={this.addQuestion}>Add Question</button>
</div>
//yada yada
}
export default App;
答案 0 :(得分:0)
您需要将uidoc = __revit__.ActiveUIDocument
doc = uidoc.Document
collector = FilteredElementCollector(doc)
list_of_categories = [
ElementCategoryFilter(BuiltInCategory.OST_StructuralColumns),
ElementCategoryFilter(BuiltInCategory.OST_Walls),
ElementCategoryFilter(BuiltInCategory.OST_Floors)
]
logical_filter = LogicalOrFilter(list_of_categories)
collector.WherePasses(logical_filter)
道具传递给name
组件。这些道具应设置为各自的状态键。
示例:
input
为清楚起见而编辑