我输入的标签是收音机类型
#! /bin/bash
entra_in_dir(){
cd $1
#if a file or a directory contains a space, i replace it with a "/", so i can scan the elements of lista without modify the default IFS
local lista=`ls|tr " " "/"`
local array=()
for elem in $lista
do
#i replace "/" with space
local temp=`echo $elem|tr "/" " "`
if [ -d "$temp" ]
then
array+=("$1""/""$temp")
elif [ -x "$temp" ]
then
echo "Executable file: ""$1""/""$temp"
elif [ -e "$temp" ]
then
echo "Regular file: ""$1""/""$temp"
fi
done
for((i=0; $i<${#array[@]}; i++))
do
echo "Directory: ""${array[$i]}"
done
echo -----------
#if array isn't empty, if there are subdirectories
if [ ${#array[@]} != 0 ]
then
for((i=0; $i<${#array[@]}; i++))
do
entra_in_dir "${array[$i]}"
done
fi
}
entra_in_dir "$1"
和onChange函数
<div className="col-md-12">
<div className="form-group clearfix">
<label htmlFor="" className="col-md-2 control-label">Authentication</label>
<div className="col-md-8">
<input type="radio" name="authentication" value="No Authentication" onChange={this.Authentication.bind(this)} />
No Authentication
<input type="radio" name="authentication" value="Master Credentials" onChange={this.Authentication.bind(this)} />
Master Credentials
</div>
</div>
</div>
onChange仅在我第二次单击时第一次被调用,onChange没有被调用无法识别出问题所在。
答案 0 :(得分:2)
添加checked
个道具,如下所示:
<div className="col-md-12">
<div className="form-group clearfix">
<label htmlFor="" className="col-md-2 control-label">
Authentication
</label>
<div className="col-md-8">
<input
type="radio"
name="authentication"
value="No Authentication"
checked={this.state.authentication === "No Authentication"}
onChange={this.Authentication.bind(this)}
/>
No Authentication
<input
type="radio"
name="authentication"
value="Master Credentials"
onChange={this.Authentication.bind(this)}
checked={this.state.authentication === "Master Credentials"}
/>
Master Credentials
</div>
</div>
</div>;