ionicons 没有出现并且之前工作正常

ionicons not showing up and It was working before

Ionicons 正在工作,突然停止工作,我不知道是什么问题,有什么想法吗? 我尝试移除引线 mr-2 但仍然无法正常工作。

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="style.css">
    <link href="https://fonts.googleapis.com/css?family=Muli:300,700&display=swap" rel="stylesheet">

    <div class="d-flex">
        <div id="sidebar-container" class="bg-primary">
            <div class="menu">
                <a href="#" class="d-block text-light p-3"><ion-icon name="radio-button-off-outline lead mr-2"></ion-icon>Singles</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="radio-button-off-outline lead mr-2"></ion-icon>Doubles</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="radio-button-off-outline lead mr-2"></ion-icon>Lower Thirds & Commentators</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="podium-outline lead mr-2"></ion-icon>Bracket Top8</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="trophy-outline lead mr-2"></ion-icon>Results</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="document-text-outline lead mr-2"></ion-icon>Extras</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="cog-outline lead mr-2"></ion-icon>Settings</a>
            </div>
        </div>
    </div>

<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script src="https://unpkg.com/ionicons@5.1.2/dist/ionicons.js"></script>

你不应该把 class 个名字放在(ion-icon 名字属性)

这是你的标签:

<ion-icon name="radio-button-off-outline lead mr-2">

这是解决方案:

<ion-icon name="radio-button-off-outline" class="lead mr-2">

这是一个完整的工作演示:

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="style.css">
    <link href="https://fonts.googleapis.com/css?family=Muli:300,700&display=swap" rel="stylesheet">
    <!-- jQuery always goes to the head section -->
    <title>DASHBoard 2.0</title>
  </head>
  <body>
    <div class="d-flex">
        <div id="sidebar-container" class="bg-primary">
            <div class="menu">
                <a href="#" class="d-block text-light p-3"><ion-icon name="radio-button-off-outline" class="lead mr-2"></ion-icon>Singles</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="radio-button-off-outline" class="lead mr-2"></ion-icon>Doubles</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="radio-button-off-outline" class="lead mr-2"></ion-icon>Lower Thirds & Commentators</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="podium-outline" class="lead mr-2"></ion-icon>Bracket Top8</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="trophy-outline" class="lead mr-2"></ion-icon>Results</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="document-text-outline" class="lead mr-2"></ion-icon>Extras</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="cog-outline" class="lead mr-2"></ion-icon>Settings</a>
            </div>
        </div>
    </div>
    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="https://unpkg.com/ionicons@5.1.2/dist/ionicons.js"></script>
  </body>
</html>

您使用 bootstrap class 作为您的 ion-icon 名字

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link href="https://fonts.googleapis.com/css?family=Muli:300,700&display=swap" rel="stylesheet">
    <script type="module" src="https://unpkg.com/ionicons@5.1.2/dist/ionicons/ionicons.esm.js"></script>

    <div class="d-flex">
        <div id="sidebar-container" class="bg-primary">
            <div class="menu">
                <a href="#" class="d-block text-light p-3"><ion-icon name="radio-button-off-outline" class="mr-2 lead"></ion-icon>Singles</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="radio-button-off-outline" class="mr-2 lead"></ion-icon>Doubles</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="radio-button-off-outline" class="mr-2 lead"></ion-icon>Lower Thirds & Commentators</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="radio-button-off-outline" class="mr-2 lead"></ion-icon>Bracket Top8</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="radio-button-off-outline" class="mr-2 lead"></ion-icon>Results</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="radio-button-off-outline" class="mr-2 lead"></ion-icon>Extras</a>
                <a href="#" class="d-block text-light p-3"><ion-icon name="radio-button-off-outline" class="mr-2 lead"></ion-icon>Settings</a>
            </div>
        </div>
    </div>

<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>