A
A
Alexander2020-08-28 09:01:36
Vue.js
Alexander, 2020-08-28 09:01:36

How to implement dynamic import of mdi icons?

Hello, I need to dynamically import mdi icons into a component. I have the following code:

async fetch() {
  const name = 'mdiTg'

  this.testIcon = await this.getIcon(name)
},

methods: {
  async getIcon(name) {
    return ({ [name]: name } = await import('@mdi/js'))
  }
}

I'm not smart enough to implement correctly. Any ideas?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question