按钮没有图标
Buttons don't have icons
我的项目是在 laravel+bootstrap 上完成的。按钮没有图标,我不知道为什么。
我的app.scss
// Fonts
@import url('https://fonts.googleapis.com/css?family=Nunito');
// Variables
@import 'variables';
// Bootstrap
@import '~bootstrap/scss/bootstrap';
.table-buttons {
text-align: right;
}
.table-buttons form {
display: contents;
}
我的 blade 有按钮
<td class="table-buttons">
<a href="{{ route('application_form.show', $application_form) }}" class="btn btn-success">
<i class="fa fa-eye"></i>
</a>
@if (!(Auth::user()->id == 2))
<a href="{{ route('application_form.edit', $application_form) }}" class="btn btn-primary">
<i class="fa fa-edit"></i>
</a>
<form method="POST" action="{{ route('application_form.destroy', $application_form) }}">
@method('DELETE')
@csrf
<button type="submit" class="btn btn-danger">
<i class="fa fa-trash-alt"></i>
</button>
@endif
</form>
</td>
当然,我用了命令npm run dev
。
我在布局 blade 中指向图标的链接:
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.3/css/fontawesome.min.css" integrity="undefined" crossorigin="anonymous">
您的 CDN link 具有“未定义”的完整性。
// Fonts
@import url('https://fonts.googleapis.com/css?family=Nunito');
.table-buttons {
text-align: right;
}
.table-buttons form {
display: contents;
}
<!--CSS-->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<!--JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous"></script>
<td class="table-buttons">
<a href="javascript:void(0)" class="btn btn-success">
<i class="fas fa-eye"></i>
</a>
<a href="javascript:void(0)" class="btn btn-primary">
<i class="fas fa-edit"></i>
</a>
</td>
使用 fontawsom v5,您必须注册并将给定的脚本插入 DOM 才能加载图标。 enter link description here
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.3/css/fontawesome.min.css" integrity="undefined" crossorigin="anonymous">
<script src="https://kit.fontawesome.com/ee826a2333.js" crossorigin="anonymous"></script>
<button type="submit" class="btn btn-danger">
<i class="fa fa-trash-alt"></i>
</button>
我的项目是在 laravel+bootstrap 上完成的。按钮没有图标,我不知道为什么。
我的app.scss
// Fonts
@import url('https://fonts.googleapis.com/css?family=Nunito');
// Variables
@import 'variables';
// Bootstrap
@import '~bootstrap/scss/bootstrap';
.table-buttons {
text-align: right;
}
.table-buttons form {
display: contents;
}
我的 blade 有按钮
<td class="table-buttons">
<a href="{{ route('application_form.show', $application_form) }}" class="btn btn-success">
<i class="fa fa-eye"></i>
</a>
@if (!(Auth::user()->id == 2))
<a href="{{ route('application_form.edit', $application_form) }}" class="btn btn-primary">
<i class="fa fa-edit"></i>
</a>
<form method="POST" action="{{ route('application_form.destroy', $application_form) }}">
@method('DELETE')
@csrf
<button type="submit" class="btn btn-danger">
<i class="fa fa-trash-alt"></i>
</button>
@endif
</form>
</td>
当然,我用了命令npm run dev
。
我在布局 blade 中指向图标的链接:
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.3/css/fontawesome.min.css" integrity="undefined" crossorigin="anonymous">
您的 CDN link 具有“未定义”的完整性。
// Fonts
@import url('https://fonts.googleapis.com/css?family=Nunito');
.table-buttons {
text-align: right;
}
.table-buttons form {
display: contents;
}
<!--CSS-->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<!--JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous"></script>
<td class="table-buttons">
<a href="javascript:void(0)" class="btn btn-success">
<i class="fas fa-eye"></i>
</a>
<a href="javascript:void(0)" class="btn btn-primary">
<i class="fas fa-edit"></i>
</a>
</td>
使用 fontawsom v5,您必须注册并将给定的脚本插入 DOM 才能加载图标。 enter link description here
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.3/css/fontawesome.min.css" integrity="undefined" crossorigin="anonymous">
<script src="https://kit.fontawesome.com/ee826a2333.js" crossorigin="anonymous"></script>
<button type="submit" class="btn btn-danger">
<i class="fa fa-trash-alt"></i>
</button>