繁体   English   中英

锚标签的链接也在Laravel Blade中打印

[英]Link of anchor tag is also printing in Laravel Blade

我有一张员工工资表。 我用anchor标记包装员工ID,以显示每个员工的工资历史记录。 问题是当我打印表格时,个人工资历史记录的link也打印在员工ID下。

这是屏幕截图打印预览:

在此处输入图片说明

<div class="d-section col-md-12">
    <table class="table table-striped table-condensed table-bordered">
        <thead>
        <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Position</th>
            <th>Start Date</th>
            <th>End Date</th>
            <th>Worked</th>
            <th>Basic</th>
            <th>OT Rate</th>
            <th>OT Hour</th>
            <th>OT Amount</th>
            <th>Basic Amount</th>
            <th>Total</th>
            <th>Signature</th>
            <th>Finger</th>
        </tr>
        </thead>
        <tbody>
        @foreach($employees as $employee)
            <tr>
                <td><a href="{{ action('SalaryController@show',[$employee->id]) }}">{{ $employee->eid }}</a></td>
                <td>{{ $employee->name }}</td>
                <td>{{ $employee->designation }}</td>
                <td>{{ $employee->start }}</td>
                <td>{{ $employee->end }}</td>
                <td>{{ $employee->worked }}</td>
                <td>{{ $employee->basic }}</td>
                <td>{{ $employee->ot_rate }}</td>
                <td>{{ $employee->ot_hour }}</td>
                <td>{{ $employee->ot_amount }}</td>
                <td>{{ $employee->basic_amount }}</td>
                <td>{{ $employee->ot_amount + $employee->basic_amount }}</td>
                <td></td>
                <td>
                    {!! Form::open(['action'=>['SalaryController@destroy',$employee->id],'class'=>'no-print','method'=>'delete','onsubmit'=>'return deleteConfirm()']) !!}
                    {!! Form::submit('X',['class'=>'element btnn btn-danger']) !!}
                    <br/>
                    <a href="{{ action('SalaryController@edit',[$employee->id]) }}" class="element btnn btn-warning" role="button"><span class="glyphicon glyphicon-edit"></span></a>
                    <br/>
                    <a href="{{ action('SalaryController@payment',[$employee->id]) }}" class="element btnn btn-success" role="button"><span class="glyphicon glyphicon-usd"></span></a>
                    {!! Form::close() !!}
                </td>
            </tr>
        @endforeach
        </tbody>
    </table>
</div>

为什么不只为锚创建CSS类并使用该类隐藏它们呢?

<a href="{{ action('SalaryController@show',[$employee->id]) }}" class="hiddenTab">foo</a>
<a href="#" class="only-print">foo</a>

在您的CSS中:

.only-print{
    display:none;
}
@media print{
    a.hiddenTab {
        display:none;
    }
    .only-print{
        display:block;
    }
}

您要隐藏的所有锚点都将使用class="hiddenTab" 如果要隐藏所有设置了href的标签,可以执行以下操作:

a[href] { display: none; }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM