聚合物将对象值的属性设置为默认值

问题描述

在 dom-repeat 中,我有一个带有两个参数的函数一个用于 id,第二个用于项目(作为下拉列表)。当基于所选项目的 id 从下拉列表中选择类型时(函数运行),并在 UI 中显示一个包含对象和一些属性(下拉列表)的数组。当 UI 加载某些下拉菜单(例如定价方法)时,应显示认值。数组中的对象,这意味着该对象可以多次显示,具体取决于我们从第一个下拉列表中选择的项目数。

下面是json格式的对象

"serviceTypeDetails": [
    {
      "serviceTypeId": 0,"productId": 0,"price": 0,"uomId": 0,"pricingMethodId": 0,"pricingReferenceNumber": "string","etfIncluded": true,"startDate": "string","asap": true,"termMonths": 0,"brokerFee": 0,"marginAdjustmentTypeId": 0,"marginAdjustmentAmount": 0,"annualEstimatedVolume": 0,"annualEstimatedVolumeUOMId": 0,"noOfSites": 0,"sitesstartDatealigned": true,"sitesEndDatealigned": true,"ldCalculationTypeId": 0,"ldrate": 0,"isAddDelete": true,"addDeletePercentage": 0,"originallyPricedVolume": 0
    }
  ],

这是在 HTML 中设置绑定的方式

<div class="column mandatory" id="pricingMethod">
                        <se-singleselect selected="{{_serviceTypeDetails.pricingMethodId}}" fieldvalue="pricingMethodId" fieldname="name" desc="Pricing Method" datasrc="{{pricingMethodItems}}" id="pricingMethodSelect"></se-singleselect>
                    </div>

我需要将pricingMethodIds 的值设置为2。我是否需要直接在绑定中对其进行硬编码?或者有更好的方法吗?

解决方法

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

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

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