我想改变这一点:
{{ Form::submit('Delete this User', array('class' => 'btn btn-warning')) }}
比如:
{{ Form::submit('<i class="glyphicon glyphicon-delete"></i>', array('class' => '')) }}
我知道第二个选项不正确,有人知道如何用正确的方式写吗?
我想改变这一点:
{{ Form::submit('Delete this User', array('class' => 'btn btn-warning')) }}
比如:
{{ Form::submit('<i class="glyphicon glyphicon-delete"></i>', array('class' => '')) }}
我知道第二个选项不正确,有人知道如何用正确的方式写吗?
使用提交类型<button>
,这比提交输入更灵活:
{{Form::button('<i class="glyphicon glyphicon-delete"></i>', array('type' => 'submit', 'class' => ''))}}
为了清楚起见,下面是类方法:
public function button($value = null, $options = array())
{
if ( ! array_key_exists('type', $options) )
{
$options['type'] = 'button';
}
return '<button'.$this->html->attributes($options).'>'.$value.'</button>';
}
正如你看到的,$value
可以容纳你放在<button>
标签里的任何东西,所以把图标放在那里应该可以-我把这个用在Fontawous图标上,它运行得很好,我个人倾向于使用那些图标,而不是Glyphicon,但原则仍然是一样的.
相反,通过使用Form::submit()
,您创建了一个<input type="submit"
,它不能接受html作为value
属性的内容,这就是为什么您的解决方案不起作用的原因.