I am trying to add padding to a shared button component through :style directive. For some reasons, the changes doesn't show up on the button. This shared component requires different padding based on different scenario so I cannot add it directly inside my button.vue
I'm new to Vuejs and would really appreciate if anyone can suggest the problem.
<Button
@on-click="currentStep = 2"
:text= "Next"
:style="padding: 12px 15px 12px 15px"
/>
If you bind something in Vue, then the value that you pass is JavaScript code.
In your case
padding: 12px 15px 12px 15px
will be interpret as JavaScript and it is not a valid JavaScript line.So if you want to pass a text, then use quotes around it, like
You can also pass an object instead
Playground