T
T
Tamerlan Godzhiev2018-09-05 18:34:07
Vue.js
Tamerlan Godzhiev, 2018-09-05 18:34:07

How to add pictures to vue array?

Hello, I'm learning vue and now I decided to make my first application. I want to make a "School timetable" application. The bottom line is that there is a field where the subject is entered. The button is pressed and the item appears in the schedule.
I implemented this functionality, but now I want the calculator icon to appear in the schedule when entering a subject, for example, "mathematics".
Please suggest how to implement this.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mShpakov, 2018-09-05
@tamerlan676

For example like this:
- make an object with the name of the object and the corresponding icon

let icons = {
  "math": "icon_name",
  "physic": "icon_name_2"
}

And then in your code you call it like this:
let subject = 'math';
console.log(icons[subject])

How to apply to your code, I hope you will understand. Or show the code

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question