Created
November 27, 2020 00:55
-
-
Save gkweb/197741d2d71b4c73abec501f69cf9ed9 to your computer and use it in GitHub Desktop.
Vue cheats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// computed: | |
// Dynamic input ID - Useful for inputs / label pairs where there is no requirement to specify the ID | |
inputId() { | |
return Math.random().toString(36).substr(2, 5) | |
} | |
// Detect if slots available programmatically (no need for prop toggles!) | |
hasSlot() { | |
return this.$scopedSlots && typeof this.$scopedSlots.slotName === 'function' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment