簡體   English   中英

#ember-power-select:更改一個電源選擇框中的值,它交替更改另一個電源選擇框的相同值

[英]#ember-power-select: changing the value in one power-select box , it alternately changes the same value for another power-select box

我在#ember-power-select中使用了custom-search-action,在一個電源選擇框中更改了值,它也為另一個電源選擇框交替更改了該值(設置與第一個選擇框中選擇的值相同)。

以下是車把代碼:

{{#each model.hpqualifications as |hpqualification|}}
{{#power-select
  selected=hpqualification.hoprofile
  search=(action "hoProfile")
  onchange=(action (mut hpqualification.hoprofile.name) value="name")
  as |repo|
}}
  {{repo.name}}
{{/power-select}}
{{/each}}

上面的代碼生成了兩個選擇框,因為#each方法具有兩個數據。

一切正常。 但是,當從第一個選擇框的下拉菜單中選擇值時,第二個選擇框也將更改為相同的值。

如何解決呢?

請參閱我之前的stackoverflow問題以獲取其他文件和數據格式。

您的問題是這樣的(action (mut hpqualification.hoprofile.name) value="name")

這實際上將更改當前選定的hoprofile對象的名稱。 這意味着,現在您可能有兩個具有相同名稱的對象。

如果將其更改回(action (mut hpqualification.hoprofile)) ,則實際上將更改所選的對象。

現在我不知道您想要獲得的最終結果是什么,但是我認為這是您的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM