0
votes

I am upgrading to the new vuetify 2.0, and I noticed the hamburger icon is not showing on the app bar.

In their examples with the same code, it does show.

https://vuetifyjs.com/en/components/app-bars

https://codepen.io/anon/pen/rXLyzE?&editable=true&editors=101

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
    <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/icon?family=Material+Icons">
    <link href="https://cdn.jsdelivr.net/npm/vuetify/dist/vuetify.min.css" rel="stylesheet">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vuex/3.1.1/vuex.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue-router/3.0.6/vue-router.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vuetify/dist/vuetify.min.js"></script>
</head>
    <body>
        <div id="app">
            <v-app>
                <v-app-bar absolute dark>
                    <v-app-bar-nav-icon></v-app-bar-nav-icon>
                    <v-toolbar-title>Title</v-toolbar-title>
                    <v-spacer></v-spacer>
                    <v-btn icon>
                      <v-icon>search</v-icon>
                    </v-btn>
                </v-app-bar>
            </v-app>
        </div>
        <script>
            new Vue({
                el: '#app',
                vuetify: new Vuetify(),
                data: () => ({
                })
            });
        </script>
    </body>
</html>

What am I missing?

Thanks

2
The codepen link isn't working.skirtle

2 Answers

7
votes

You're just missing the icon CSS:

<link href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css" rel="stylesheet">

See https://vuetifyjs.com/en/getting-started/quick-start#cdn-usage

Update:

From the original question:

<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/icon?family=Material+Icons">

This will be pulling in the icons from Material Design, see:

https://material.io/tools/icons/?style=baseline

Despite the naming similarity, this is a different icon set from Material Design Icons (MDI):

https://materialdesignicons.com/

The search icon comes from Material Design, it would be called mdi-magnify in MDI.

By default Vuetify uses MDI. If you want to switch everything across to Material Design there is a guide in the documentation:

https://vuetifyjs.com/en/customization/icons#install-material-icons

2
votes

Current Version

I'm using Vue CLI 3 and I had the same issue.

  • vuetify v2.0.0
  • @mdi/font v4.4.95

Solution

first, please add @mdi/font library to your package.son

$ yarn add @mdi/font

second, import materialdesignicons.scss to your SCSS like this.

// application.scss
$mdi-font-path: "~@mdi/font/fonts" !default;
@import '~@mdi/font/scss/materialdesignicons';

After compile

enter image description here