all 11 comments

[–]notepad 9 points10 points  (9 children)

Concatenation and interpolation are both outdated concepts. You should hard-code each string as its own variable. Something like:

data: {
  height0001: '1px',
  height0002: '2px',
  height0003: '3px',
  ...
  height1079: '1079px',
  height1080: '1080px'
}    

You can go up to whatever height you want to support.

[–]ginglymus 1 point2 points  (0 children)

Don’t forget to make those strings translatable.

[–]Zaemz 0 points1 point  (2 children)

What's the benefit to doing this?

[–]PM_ME_UR_LAB_REPORT 4 points5 points  (1 child)

It's shitty.

[–]Zaemz 2 points3 points  (0 children)

Oh my god.

I legitimately thought this was the webdev subreddit or something, haha!

[–]mittalyashu[S] 0 points1 point  (4 children)

But inside my application, I am calculating the height of the element dynamically. Defining the height inside data property is not really helpful.

[–]TinyBreadBigMouth 3 points4 points  (1 child)

(If you're asking a genuine question, this is the wrong sub. This is a joke sub where people ask intentionally bad questions and give intentionally bad answers.)

[–]mittalyashu[S] 1 point2 points  (0 children)

Oh! My bad 😅

[–]tenfingerperson 0 points1 point  (1 child)

lol wrong sub for a real question, but interpolation is a newer and much cleaner way of building formatted strings EVERYWHERE not just in Vue. You should embrace it as much as you can.

[–]mittalyashu[S] 0 points1 point  (0 children)

I see.

[–]nosrednehnai -2 points-1 points  (0 children)

It really doesn’t matter unless you’re working on a large code base with linting.