Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/408.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何访问选择标记中选定选项的对象?流星及;火焰_Javascript_Html_Meteor_Meteor Blaze - Fatal编程技术网

Javascript 如何访问选择标记中选定选项的对象?流星及;火焰

Javascript 如何访问选择标记中选定选项的对象?流星及;火焰,javascript,html,meteor,meteor-blaze,Javascript,Html,Meteor,Meteor Blaze,我试图通过使用视图模型帮助程序来处理tradingPair的选择,该帮助程序将调用该对应发送到的函数:select()。它只返回对象对象… 为什么Blaze/Meteor不能正确地将此值传递给我的助手函数 //HTML <select class="select-pair-drop" id="pairOptions" {{b "change: handleChange"}}> {{#each t

我试图通过使用视图模型帮助程序来处理
tradingPair
的选择,该帮助程序将调用该对应发送到的函数:
select()
。它只返回
对象对象

为什么Blaze/Meteor不能正确地将此值传递给我的助手函数

  //HTML
  <select class="select-pair-drop" id="pairOptions" {{b "change: handleChange"}}> 
          {{#each tradingPairs}}
            <option value={{this}} name="pairOption">
              <span class="base">{{this.base}}</span> / <span class="quote">{{this.quote}}</span>
            </option>
          {{/each}}
   </select>

  // JS in a Template.<name>.viewmodel()
  handleChange(event) {
   event.preventDefault();
   const choice = (event.target.value);
   console.log(choice);
   this.select(choice);
  }
//HTML
{{{#每个交易对}
{{this.base}}/{{this.quote}
{{/每个}}
//模板中的JS..viewmodel()
手变(活动){
event.preventDefault();
const choice=(event.target.value);
console.log(选项);
这个。选择(选择);
}

问题是,我的
console.log
只返回
object对象
,而对象似乎传递错误。有人能帮我吗?我已经为此挣扎了一段时间-如果我能提供更多的清晰或信息,请告诉我。

这是否回答了您的问题?如果您想查看[object],请使用console.log(JSON.stringify(choice))