After vue jumps back to the previous route, the data is partially refreshed.

vue-router route jumps back to the original page, and the original page is partially refreshed?

after the company name is selected, click the change in table, and the page will jump to another page. After the modification is completed and saved, it will jump back to the original page again, that is, the page displayed. The user does not operate any more. How to realize that the input in the company is still selected and the data is refreshed?

Mar.03,2021

where did you get your list data first? Why don't you just get the data and assign it to data when you enter the page?
or can't you use the routing parameters to bring it back and re-assign it when the modification is successfully redirected?


< keep-alive > is a built-in component of Vue that keeps the state in memory during component switching to prevent repeated rendering of DOM.
https://blog.csdn.net/leileib.


    beforeRouteLeave: function(to, from , next){
            var self = this;
            var oldData=JSON.stringify(self.tableDataBackup);
            var newData=JSON.stringify(self.tableData);
            if(newData!=oldData){
            // next(false)
            this.$confirm(', ?', '', {
                confirmButtonText: '',
                cancelButtonText: '',
                type: 'warning'
            }).then(() => {
                // 
                // next();
                self.save();
                next(false);
            }).catch(() => {
                    next();
                });
            }
            else{
                next()
            }
        },

this is an example where you back up the data, compare the data, and select the actions to be performed after execution, such as selecting input

if you want to.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e812ae-4e004.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e812ae-4e004.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?