LoginBlock.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <script>
  2. import Vue from 'vue'
  3. import { mapState, mapActions } from 'vuex'
  4. export default {
  5. props: ['title', 'block'],
  6. data () {
  7. return {
  8. template: null,
  9. mail: '',
  10. password: ''
  11. }
  12. },
  13. // computed: {
  14. // ...mapState(['User'])
  15. // },
  16. methods: {
  17. ...mapActions({
  18. userLogin: 'User/userLogin'
  19. }),
  20. login () {
  21. this.userLogin({
  22. mail: this.mail,
  23. pass: this.password
  24. })
  25. },
  26. request_password () {
  27. console.log('request_password');
  28. },
  29. create_account () {
  30. console.log('create_account');
  31. }
  32. },
  33. beforeMount() {
  34. // console.log('LoginBlock beforeMount', this._props.block);
  35. if(this._props.block){
  36. // console.log('LoginBlock beforeMount if this._props.block ok');
  37. this.template = Vue.compile(this._props.block)
  38. this.$options.staticRenderFns = [];
  39. this._staticTrees = [];
  40. this.template.staticRenderFns.map(fn => (this.$options.staticRenderFns.push(fn)));
  41. }
  42. },
  43. mounted(){
  44. // console.log('LoginBlock mounted');
  45. Drupal.attachBehaviors(this.$el);
  46. },
  47. render(h) {
  48. // console.log('LoginBlock render');
  49. if(!this.template){
  50. // console.log('LoginBlock render NAN');
  51. return h('span', 'Loading ...')
  52. }else{
  53. // console.log('LoginBlock render template');
  54. return this.template.render.call(this)
  55. }
  56. }
  57. }
  58. </script>
  59. <style lang="scss" scoped>
  60. // section{
  61. // max-width:300px;
  62. // }
  63. // input{
  64. // display:block;
  65. // max-width:100%;
  66. // margin:0.5em 0 0 0;
  67. // }
  68. // button{
  69. // margin:0.5em 0 0 0;
  70. // }
  71. // ul{
  72. // margin:0; padding:0.5em 0 0 0;
  73. // }
  74. // li{
  75. // list-style:none;
  76. // margin:0.5em 0 0 0; padding:0;
  77. // font-size:0.882em;
  78. // }
  79. // a{
  80. // }
  81. </style>