vue工程中使用iconfont在線CDN不生效的問題


為什么在vue工程中引入iconfont有時候不生效呢?

請依次使用以下方法

1. 在index.html中引入在線資源

<!DOCTYPE html>
<html lang="en" style='height: 100%;'>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <link rel="icon" href="<%= BASE_URL %>favicon.ico">
  <!-- 引入下面這個cdn資源 -->
  <link rel="icon" href="//at.alicdn.com/t/font_918300_q5yxfof3wjo.css">

  <title>vue-shop-front</title>
</head>

<body style='height: 100%;'>
  <noscript>
    <strong>We're sorry but vue-shop-front doesn't work properly without JavaScript enabled. Please enable it to
      continue.</strong>
  </noscript>
  <div id="app"></div>
  <!-- built files will be auto injected -->
</body>

</html>

2. 在mainjs中使用Vue.use()引入

Vue.use('//at.alicdn.com/t/font_918300_q5yxfof3wjo.css')

3. 在App.vue中import引入(前提是你得使用了預處理器)

<style lang="scss" scoped>
@import url("//at.alicdn.com/t/font_918300_q5yxfof3wjo.css");
#wrap-box {
  height: 100%;
  // height: 1000px;
}
</style>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM