Login.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. <input
  13. id="edit-pass"
  14. class="form-text"
  15. type="password"
  16. placeholder="Password" name="pass"
  17. v-model="password"
  18. @keyup.enter="login"
  19. />
  20. <button
  21. id="edit-submit"
  22. class="button"
  23. @click.stop="login"
  24. >
  25. login
  26. </button>
  27. </section>
  28. </div>
  29. </template>
  30. <script>
  31. // https://github.com/alvar0hurtad0/drupal-vuejs-todo
  32. import { mapState, mapActions } from 'vuex'
  33. export default {
  34. data () {
  35. return {
  36. mail: '',
  37. password: ''
  38. }
  39. },
  40. computed: {
  41. ...mapState(['User']),
  42. // ...mapState({
  43. // isloggedin: state => state.user.isloggedin,
  44. // username: state => state.user.username,
  45. // token: state => state.user.token
  46. // })
  47. },
  48. methods: {
  49. ...mapActions({
  50. getToken: 'User/getToken'
  51. }),
  52. // usernameInputHandler(input) {
  53. // this.username = input;
  54. // },
  55. // passwordInputHandler(input) {
  56. // this.password = input;
  57. // },
  58. login () {
  59. this.getToken({
  60. mail: this.mail,
  61. pass: this.password
  62. })
  63. }
  64. }
  65. }
  66. </script>
  67. <style lang="scss" scoped>
  68. </style>