我是Ember的新手(使用版本0.2.3).我有一个具有一些计算值的组件.他们从输入字段收集这些计算值:
export default Component.extend({
loanAmount : 200000,
deductible : 0,
debtInt : 5,
getLoanCosts: computed('loanAmount', 'debtInt', function(){
return (get(this, 'debtInt')/12) * get(this, 'loanAmount');
})
Run Code Online (Sandbox Code Playgroud)
在我的template.hbs上,我有一个输入字段{{ input value=loanAmount }},我可以{{getLoanCosts}}在我的template.hbs中调用,以显示计算的成本.这适用于文本/数字输入.
但是,我需要一个带有两个值的单选按钮输入(是和否).这应该与deductible我的组件中的值对齐(即这笔贷款可以扣除吗?).但是,如果我这样做:
Yes {{ input type="radio" name="deductible" value=deductible }}
No {{ input type="radio" name="deductible" value=deductible }}
Run Code Online (Sandbox Code Playgroud)
我无法为这两个输入设置值,就像我可以使用直接HTML一样.如果我设置value = 0和value = 1,它们永远不会在我的组件中更新.如何deductible根据是或否选择更新我的组件?
我对PHP有点新,遇到了问题.这是我有的:
$select_all = "SELECT * FROM latesttest";
$result = mysql_query($select_all)
or die(mysql_error());
$row = mysql_fetch_assoc($result);
foreach($row as $k=>$v){
echo $k . "=" . $v . "<br />";
}
Run Code Online (Sandbox Code Playgroud)
这有效并且给了我:V1 =测试V2 = 1234 V3 = Something等.
但是我希望以这种方式反映表格中每一行的结果.如果我运行SELECT*FROM latesttest; 在MySQL中,我在这个表中有4条记录.如何以上述格式显示所有4行?