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))