Login.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template lang="html">
  2. <div id="block-userlogin" class="">
  3. <h2>Login Hello!</h2>
  4. <section>
  5. <input
  6. id="edit-name"
  7. class="form-email"
  8. type="text"
  9. placeholder="Email" name="name"
  10. v-model="mail"
  11. @keyup.enter="login"
  12. />
  13. <input
  14. id="edit-pass"
  15. class="form-text"
  16. type="password"
  17. placeholder="Password" name="pass"
  18. v-model="password"
  19. @keyup.enter="login"
  20. />
  21. <button
  22. id="edit-submit"
  23. class="button"
  24. @click.stop="login"
  25. >
  26. login
  27. </button>
  28. </section>
  29. </div>
  30. </template>
  31. <script>
  32. // https://github.com/alvar0hurtad0/drupal-vuejs-todo
  33. import { mapState, mapActions } from 'vuex'
  34. export default {
  35. data () {
  36. return {
  37. mail: '',
  38. password: ''
  39. }
  40. },
  41. computed: {
  42. ...mapState(['User'])
  43. },
  44. methods: {
  45. ...mapActions({
  46. userLogin: 'User/userLogin'
  47. }),
  48. // usernameInputHandler(input) {
  49. // this.username = input;
  50. // },
  51. // passwordInputHandler(input) {
  52. // this.password = input;
  53. // },
  54. login () {
  55. this.userLogin({
  56. mail: this.mail,
  57. pass: this.password
  58. })
  59. }
  60. }
  61. }
  62. </script>
  63. <style lang="scss" scoped>
  64. </style>