code.js 459 B

12345678910111213141516171819202122232425
  1. // Or use axios directly instead of this.$http.
  2. Vue.prototype.$http = axios;
  3. const app = new Vue({
  4. el: '#root',
  5. data: {
  6. name: '',
  7. description: ''
  8. },
  9. methods: {
  10. /**
  11. *
  12. * @param {Event} e
  13. */
  14. onSubmit(e) {
  15. // or use @submit.prevent at the HTML call point
  16. // e.preventDefault();
  17. this.$http.post('index.php/projects', this.$data).then(function () {
  18. console.log(arguments);
  19. });
  20. }
  21. }
  22. });