DOM未更新如果handlebarsJS中的初始状态为false,如何在{{#IF}}语句中使用嵌套的{{#EACH}}?

问题描述

我有一个带有下拉列表的表单,该表单基于变量 import sympy sum=0 lst1=[] for num in range(1,1000): #isprime(n):return True when the num is prime and false when the num is composite if sympy.isprime(num) is True: sum+=num lst1.append(sum) print("The sum list 1 is: ",lst1) lst2=[] for sum in lst1: if sum<1000: if sympy.isprime(sum)==True: lst2.append(sum) print("The list 2 is: ",lst2) print("The required answer is :",max(lst2)) 隐藏-我遇到了DOM问题,其中存在数据,但新显示的元素无法访问它。

当我选择高级搜索时,我只想看到下拉菜单,但是没有填充选项-是否有mode之类的仍在DOM上但被隐藏的有角度的hide/show

车把助手:

advancedSearch: (mode,options) => {
      console.log('MODE: ',mode)
      return mode !== 'advanced' ? '' : options.fn();
    } 

视图:

{{#advancedSearch mode}}

            <div class="input-group select-full">
                
                <label for='location'>Location</label>

                <select id='location' name="location" class="input-Box">
                    <option value='' selected='true'>Location</option>
                    {{#each locations}}
                    <option value="{{DropDownValue}}">{{DropDownValue}}</option>
                    {{/each}}
                </select>
            </div>
...
{{/advancedSearch}}

获取数据的功能位于根路由上

let locations = {}
router.get('/',async (req,res) => {

    let { mode } = req.query;
    if (mode) {
         XRef_OfficeLocations.findAll().then((list) => {
            console.log('got XRef_Locations...',list.length)
            locations = list;
            res.render('directory',{ mode,departments,locations })
        }).catch((e) => console.log(e))
        
    } else {
        res.render('directory',{ departments,locations })
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)