【问题标题】:Trying to get the delete button to show the icon试图让删除按钮显示图标
【发布时间】:2016-04-03 00:00:10
【问题描述】:

我正在尝试让字体真棒图标显示在我的 laravel 表单中的删除按钮中。

这里是删除按钮

{{ Form::submit('<i class="fa fa-pencil"></i> Delete', array('class' => 'btn btn-danger', 'role' => 'button')) }}

【问题讨论】:

    标签: laravel laravel-4 font-awesome


    【解决方案1】:
        {{Form::button(' Se connecter<i class="fa fa-key icon-on-right"></i>', array(
                            'type' => 'submit',
                            'class'=> 'pull-right btn btn-primary',
                            ))}}
    

    【讨论】:

    • 也许您可以添加一些注释来解释这是如何回答问题的。
    【解决方案2】:

    当您使用 Form::submit 时,内容总是被转义。您可以改用 Form::button ,它不会转义内容。

    您的代码可以调整为:

    {{ Form::button('<i class="fa fa-pencil"></i> Delete', ['class' => 'btn btn-danger', 'role' => 'button', 'type' => 'submit']) }}
    

    同时确保在使用 Form::button 时设置 type = submit

    【讨论】:

    • 在 Laravel 和 Collective 5.2 上为我工作
    【解决方案3】:

    查看我的previous answer

    基本上,laravel 允许使用 {{HTML::decode(&lt;insert Form button here&gt;) }} 解码任何 html

    【讨论】:

      【解决方案4】:

      不幸的是,表单构建器总是会逃避它的内容。此外,提交输入类型仅支持文本内容,不支持 HTML。您需要使用按钮元素来显示 HTML 内容。

      <button class="btn btn-danger"><i class="fa fa-pencil"></i> Delete</button>
      

      【讨论】:

        猜你喜欢
        • 2020-08-26
        • 2017-10-22
        • 2018-12-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多