vuetify icon not showing

て烟熏妆下的殇ゞ 提交于 2019-12-01 18:14:22

If you are using Vuetify, then you should simply use the <v-icon> component which supports both Material and Font Awesome icons: documentation

Example:

<v-icon>arrow_downward</v-icon>

By using Vuetify, you basically won't need to use the class="icon_name" syntax anymore.

EDIT: icon references - Material Design & Font Awesome

With Vue CLI 3 we has no index.html in the src folder so alternatively you can

npm install --save material-design-icons-iconfont

and import it in the main.js file

import 'material-design-icons-iconfont/dist/material-design-icons.css'

You can face the exact same issue if you use Nuxt.js. To solve this issue, you have to declare the Material Design icons in your CSS ... through the CDN, for example, as below:

link: [
  { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
    {
      rel: 'stylesheet',
      href:
          'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons'
    }
]

Had this issue with Vuetify 2.1.3 installed via the vuetify-loader 1.2.2

Seems like previous solutions do not work becues the default icons library has changed to mdi-font.

Solution was:

yarn add @mdi/font

And in the file plugins/vueitfy.js add this line below the imports

import '@mdi/font/css/materialdesignicons.css'
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!