在下面的代码中,我手动检查每个视图是否有内容或为空。如果它有一些内容,那么我正在摧毁它。我不想手动检查每个视图,我想要一个动态选择非空视图的代码,以便我可以销毁该视图而无需手动检查。一次只有一个非空视图。
function reset_container() {
if (aasview != null) {
aasview.destroy();
}
if (alewives != null) {
alewives.destroy();
}
if (aa_amendview != null) {
aa_amendview.destroy();
}
if (aa_dispatchview != null) {
aa_view.destroy();
}
if (aa_postview != null) {
aa_postview.destroy();
}
if (cc_dispatchview != null) {
cc_dispatchview.destroy();
}
if (cc_postview != null) {
cc_postview.destroy();
}
if (cm_salesview != null) {
cm_salesview.destroy();
}
if(cc_view!=null){
cc_view.destroy();
}
if (cc_amendview != null) {
cc_amendview.destroy();
}
if (quotationview != null) {
quotationview.destroy();
}
if(truckview!=null){
truckview.destroy();
}
if (create_mnview != null) {
create_mnview.destroy();
}
if (create_stoview != null) {
create_stoview.destroy();
}
if(vehicle_view != null){
vehicle_view.destroy();
}
}