Guest User

Untitled

a guest
Apr 19th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.35 KB | None | 0 0
  1. /**
  2. * First we will load all of this project's JavaScript dependencies which
  3. * includes Vue and other libraries. It is a great starting point when
  4. * building robust, powerful web applications using Vue and Laravel.
  5. */
  6.  
  7. require('./bootstrap');
  8.  
  9. window.Vue = require('vue');
  10.  
  11. /**
  12. * Next, we will create a fresh Vue application instance and attach it to
  13. * the page. Then, you may begin adding components to this application
  14. * or customize the JavaScript scaffolding to fit your unique needs.
  15. */
  16.  
  17. Vue.component('example-component', require('./components/ExampleComponent.vue'));
  18.  
  19. const app = new Vue({
  20.  
  21. el: '#vueJsContainer',
  22.  
  23. data: {
  24.  
  25. // Variables
  26. todos: [], // Direction for v-for tag. array 1
  27. quantityOfRecords: null, // quantity of records
  28. name: '',
  29. errors: ''
  30.  
  31. },
  32.  
  33. methods: {
  34.  
  35. // Button event handler
  36. greet: function(event){
  37. console.log("Search button clicked. Vue even handler2");
  38.  
  39. // Ajax request. Axios
  40. axios.get('/addmsgws/' + document.getElementById("searchInputTextField").value)
  41. .then(function (response) {
  42. console.log(response);
  43. })
  44. .catch(function (error) {
  45. console.log(error);
  46. });
  47.  
  48. },
  49.  
  50. message: function(message){
  51.  
  52. // Ajax request. Axios
  53. axios.get('public/assetcreate/' + message[0] + '/' + message[1] + '/' + message[2] + '/' + message[3] + '/' + message[4])
  54. .then(function (response) {
  55. console.log(response);
  56. })
  57. .catch(function (error) {
  58. console.log(error);
  59. });
  60. }
  61.  
  62.  
  63. },
  64.  
  65. created() {
  66.  
  67. Echo.channel('tbrChannel')
  68.  
  69. .listen('TbrAppSearchResponse', (e) => {
  70. var jsonParsedResponse = JSON.parse(e.update);
  71. console.log("search responce: " + jsonParsedResponse);
  72. this.quantityOfRecords = jsonParsedResponse; // Loop through the length or received json
  73.  
  74. }); // echo.listen
  75. }, // created
  76.  
  77.  
  78. }); // new Vue
  79.  
  80.  
  81.  
  82. const app2 = new Vue({
  83.  
  84. el: '#vueJsForm',
  85.  
  86. data: {
  87.  
  88. inp: '',
  89. basketid: ''
  90.  
  91. },
  92.  
  93. methods: {
  94.  
  95. onSubmit(basket_id){
  96. this.basketid = basket_id;
  97. axios.post('/getbasketname', this.$data )
  98. .then(response => console.log(response.data)) // Output returned data by controller
  99. .catch(error => {
  100. console.log(error.response);
  101. })
  102. }
  103.  
  104. },
  105.  
  106. // When page is loaded and dom created
  107. created(){
  108. //this.basketid = basket_id;
  109. this.onSubmit();
  110. axios.post('/getbasketname', this.$data )
  111. .then(response => {
  112. console.log(response.data);
  113. this.basketid = response.data;
  114. })
  115. .catch(error => {
  116. console.log(error.response);
  117. })
  118. }
  119.  
  120.  
  121. }); // Vue
  122.  
  123.  
  124.  
  125.  
  126. /*
  127. // Buttons handlers
  128. $('#search').click(function () {
  129. console.log("Search button clicked");
  130. // //alert($("#searchInputTextField").val());
  131.  
  132. //$("tbody").remove();
  133. var request1 = $.get('/public/addmsgws/' + $("#searchInputTextField").val() + ''); // Controller call
  134. request1.done(function(response) { // When the request is done
  135. console.log("Request1 is done");
  136. });
  137. });
  138. */
Add Comment
Please, Sign In to add comment