yaminncco / vue-sidebar-menu

A Vue.js Sidebar Menu Component
MIT License
646 stars 194 forks source link

I'm trying to use a custom svg icon for the sidebar but it's not appearing #187

Closed Rishi-Bidani closed 3 years ago

Rishi-Bidani commented 3 years ago
        {
          href: "/",
          title: "Custom Icon",
          icon: {
            element: "img",
           attributes: {
              src: "./assets/customicon.svg",
              alt: "Custom Icon",
            },
          },
        },
yaminncco commented 3 years ago

create an svg icon component or you can use vue-svg-loader

Rishi-Bidani commented 3 years ago

@yaminncco I found an easier solution which seems to work. I've just started learning vuejs so I didn't want to confuse myself with complicated features like vue-svg-loader, even if it might be useful later on. I'm also attaching an image of it working image

You can just require the svg icon and use it as follows

const customSvG= require("./assets/customSVG.svg");

        {
          href: "/",
          title: "New SVG",
          icon: {
            element: "img",
            attributes: {
              src: customSVG,
              // alt: "new Folder",
            },
          },
        },

Anyway thank you for your reply, it certainly directed me in the correct direction for finding this.