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

Added slot support for buttons #28

Merged
merged 1 commit into from
May 8, 2019
Merged

Added slot support for buttons #28

merged 1 commit into from
May 8, 2019

Conversation

lochstar
Copy link
Contributor

@lochstar lochstar commented May 8, 2019

Hi,

I've added support for named slots for each key in a layout. This enables you to render SVGs, images or whatever you'd like instead of plain text keys. This should close off #14 and does not break existing functionality.

Slots use the action name for named actions, or the value for all other keys.

Example usage:

<vue-keyboard
  v-show="keyboardVisible"
  v-model="keyboardInput"
  :layouts="compactLayout"
>
  <template #backspace>
    <font-awesome icon="backspace" />
  </template>
  <template #q>
    <img src="q.png">
  </template>
</vue-keyboard>

I've also added the key attribute on the v-for loops as it's generally recommended and my linter complains. If you'd rather I remove this please let me know.

@martywallace martywallace merged commit 6f1ac77 into martywallace:master May 8, 2019
@martywallace
Copy link
Owner

That's pretty sweet, thanks a lot.

@lochstar lochstar deleted the slot-support branch May 8, 2019 09:32
@gchoza
Copy link

gchoza commented Dec 20, 2019

Having trouble using slots. I can make CSS take effect by using v-deep: (::v-deep .vue-keyboard button {}) but cannot use slots. I may be missing something obvious. Using version 3.1.0.

        <keyboard
          v-show="dobActive"
          @input="changed"
          @today="today"
          @minus="minus"
          @plus="plus"
          layouts="/{-1:minus}{today:today}{+1:plus}/|123|456|789|{clr:clear}0{del:backspace}"
          v-model="patDOB"
        >
          <template #backspace
            ><img
              src="GCAT/Images/back.png"
              style="height: 18px; width: 18px;"
            />
          </template>
        </keyboard>

import keyboard from "vue-keyboard";
components: { keyboard },

@lochstar
Copy link
Contributor Author

Hey @gchoza, 3.1.0 was released Jun 2017 and this PR was made this year. Unless @martywallace can publish an update, you'll have to checkout master manually in your project to use this feature.

@gchoza
Copy link

gchoza commented Dec 20, 2019

Thanks, that explains it. I copied master and I'm OK.
I'll keep checking to see when there's an update.
This is a very nice keyboard. Thank you @martywallace !

@lochstar thanks for helping.

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

Successfully merging this pull request may close these issues.

None yet

3 participants