SoFunction
Updated on 2025-04-04

vue strength hits the pit, the current page push is invalid. The solution is to solve the problem of invalidating the current page

vue current page push current page invalid

When the push page jumps to the current page in the current page, it is just that the push parameters are different, and you can only use string splicing, and neither parameters nor query will work. Don't know why. . .

For example: the url of the current page is

/invest/myinvest?page=1&day=0-30`

But when you want to click, change the parameters, so

this.$({path:'/invest/myinvest?',query:{page:1,day:'0-30'}})

However, it is useless. . . .

Only:

this.$("/invest/myinvest?page="+currentPage+"&day="day);

vue push error

TypeError: Cannot read property ‘push‘ of undefined

('/processing/', {})
     .then(function (response) {
       ();
       if ( == 'no_processing') {
         alert("The article analysis failed!");
         return;
       }else if(=='empty_processing'){
         alert("The article data is empty and cannot be analyzed!")
         return;
       }
       (function(element){
          this.processing_tableData.push(element);  // "push" error          (element);
        });
       ("ok_processing")
     })
     .catch(function (error) {
       (error);
     })

Report an error:

TypeError: Cannot read property ‘push’ of undefined

Solution

Defining a value externally refers to the Vue instance

var self = this; //External definition('/processing/', {})
     .then(function (response) {
       ();
       if ( == 'no_processing') {
         alert("The article analysis failed!");
         return;
       }else if(=='empty_processing'){
         alert("The article data is empty and cannot be analyzed!")
         return;
       }
       (function(element){
          self.processing_tableData.push(element);  //Put "this"="self"          (element);
        });
       ("ok_processing")
     })
     .catch(function (error) {
       (error);
     })

The above is personal experience. I hope you can give you a reference and I hope you can support me more.