therufa / mdi-vue

Material design icons for vue.js
https://www.npmjs.com/package/mdi-vue
MIT License
88 stars 13 forks source link

Add possibility to use object for property "size" (additionally to Number and String) #53

Closed robertfausk closed 3 years ago

robertfausk commented 3 years ago

It would be nice if the following is working:

<mdicon
  name="ArrowCollapseVertical"
  :size="{ 12: isOpen, 14: !isOpen }"
/>

but it throws [Vue warn]: Invalid prop: type check failed for prop "size". Expected Number, String, got Object.

Currently i depend on following workaround:


<mdicon
  v-if="isOpen"
  name="ArrowCollapseVertical"
  size=12
/>
<mdicon
  v-else
  name="ArrowCollapseVertical"
  size=14
/>
therufa commented 3 years ago

see more at issue #52

although this seems to make more sense, I find it a little bit misleading. The fact that we're speaking of an object here would indicate that this property could have multiple true values which makes no sense in the context of this component.

Therefore I think that the issue you've demonstrated is being solvable by introducing a condition with the intended values.

Same here again; i'm closing the issue, but if you feel that I missed the point, just reopen the issue.

Happy hacking! 😎