My SMM panel
 
 
 
 
 
 

39 lines
884 B

  1. <template>
  2. <form id="payment-form" action="">
  3. <label for="name">Name on Card</label>
  4. <input v-model="billingName" id="billing-name" type="name">
  5. <div id="card-element"></div>
  6. <div id="card-errors"></div>
  7. <div id=save-card>
  8. <input name="save-card" type="checkbox" checked="true">
  9. <label for="">Save Card</label>
  10. </div>
  11. </form>
  12. </template>
  13. <script>
  14. function mountPaymentForm() {
  15. this.card = this.stripe.elements().create('card')
  16. this.card.mount('#card-element')
  17. this.card.on('change', function(event) {
  18. let displayError = document.getElementById('card-errors');
  19. if (event.error) {
  20. displayError.textContent = event.error.message;
  21. } else {
  22. displayError.textContent = '';
  23. this.cardValid = true
  24. }
  25. }.bind(this));
  26. }
  27. export default {
  28. data() {
  29. return {billingName: null}
  30. },
  31. methods: {mountPaymentForm},
  32. props: ['stripe'],
  33. mounted: mountPaymentForm
  34. }
  35. </script>