Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use the customStyle property #62

Closed
Tarabass opened this issue Oct 18, 2019 · 4 comments
Closed

How to use the customStyle property #62

Tarabass opened this issue Oct 18, 2019 · 4 comments

Comments

@Tarabass
Copy link

Tarabass commented Oct 18, 2019

For now the size accepts only numbers. I want to be able to use 7vw instead of 70px. My idea was to use this:

:customStyle="{ height: '7vw !important;', width: '7vw !important;' }"

But it doesn't work :(

@kasnti
Copy link

kasnti commented Apr 4, 2020

:customStyle="vueAvatar.styleObject"

data() {
    return {
      vueAvatar: {
        styleObject: {
          height: '7vw !important'
          width: '7vw !important'
        },
      }
    }
  }

@Tarabass
Copy link
Author

Tarabass commented Apr 4, 2020

@kasnti That would result in exactly the same thing. But while I was trying your code I noticed that the problem was within my own code.

If I remove the semicolons it works. This is how Vue is expecting it and what I did wrong.

<avatar :customStyle="{ height: '7vw', width: '7vw' }" username="Jane Doe"></avatar>

@kasnti
Copy link

kasnti commented Apr 5, 2020

@Tarabass you are right

@Tarabass
Copy link
Author

Tarabass commented Apr 5, 2020

Thank you for pointing me into the right direction 😝

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants