Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

login.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. Vue.component('login-panel', {
  2. template: `
  3. <form action="">
  4. <div class="modal-card" style="width: auto">
  5. <header class="modal-card-head">
  6. <p class="modal-card-title">Login</p>
  7. </header>
  8. <section class="modal-card-body">
  9. <b-field>
  10. <b-input
  11. placeholder="User (Ohmportal)"
  12. :value="user"
  13. v-model=user
  14. required>
  15. </b-input>
  16. </b-field>
  17. <b-field>
  18. <b-input
  19. type="password"
  20. placeholder="Password"
  21. :value="pwd"
  22. required>
  23. </b-input>
  24. </b-field>
  25. <b-checkbox>Eingeloggt bleiben</b-checkbox>
  26. <div v-if="showError" style="color:red;"> Versuche es nochmal.</div>
  27. </section>
  28. <footer class="modal-card-foot">
  29. <button class="button" type="button" @click="$parent.close()">Close</button>
  30. <button class="button is-primary" @click="checkData()">Login</button>
  31. </footer>
  32. </div>
  33. </form>`,
  34. data: function () {
  35. return {
  36. user: "name",
  37. pwd:"password",
  38. showError:false,
  39. };
  40. },
  41. methods: {
  42. checkData(){
  43. if(this.user === "name" && this.pwd === "password"){
  44. console.log("correct");
  45. this.$parent.close();
  46. }else{
  47. console.log("wrong");
  48. this.showError=true;
  49. }
  50. },
  51. logIn(){
  52. $parent.close();
  53. },
  54. },
  55. });