0

here's the code:

$.each(app.rows, function(index, obj) {
  $.each(obj, function(ind, ob) {
    if (ind == 'hasStuff') {
      if (ob == 1) {
        app.rows[index][ind] = '<i class="las la-list-ul small"></i><img src="../_img/yes.png" alt"yes"/>';
      } else {
        app.rows[index][ind] = '<i class="las la-ban small"></i><img src="../_img/no.png" alt"no"/>';
      }
    }
  })
})

what it renders is the actual text, not the image it points to. can't get either font icons or images to display, just the literal text. the array renders out properly in all other respects, but not this part. i'm kinda stumped. and nothing i've found seems to be of help.

the paths are confirmed correct, please don't ask me about that.

EDIT: as i commented below, but will include here for easier viewing, this code REPLACES values from an array. the original array comes from a database query and, as this is done ad hoc, i can't declare it beforehand. also, for 200,000+ records, not feasible.

EDIT2: this piece of code INTERCEPTS THE RESULTS OF A DATABASE QUERY, swaps the boolean -1- for an image and an icon, then loops through a v-for in the template. this is pretty basic stuff. i just don't know why Vue isn't rendering this out. when the v-for loops through the modified array, it doesn't render either the image or the icon, it just outputs the raw HTML. whyyyy????

what am i missing?

4
  • Does this answer your question? Vue not binding data to image src Commented Mar 1, 2020 at 10:38
  • sadly, no. i looked at that article. the code above modifies an object returned from an database query, replacing the boolean with an image. since this is done ad hoc, i can't require it in the data binds beforehand. Commented Mar 1, 2020 at 10:46
  • Is there a reason for storing HTML in an array instead of simply using a v-for in the template? This is atypical and potentially a sign of an anti-pattern. Commented Mar 1, 2020 at 13:12
  • ...did you not read what i wrote? i am replacing the boolean value from the database query results with an image and an icon. this then loops through a v-for. or at least, trying to... the array is a temporary working array. perfectly typical. Commented Mar 1, 2020 at 20:17

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.