How to add and edit on a page?

The

list operates on one page, and adds and edits on one page. When you click to edit a row of data in table, you can call to query the data according to ID for echo. But how to transfer the echoed data to the new page? I learned that it is troublesome to pass values through bus and vuex, bus. As soon as vuex refreshes the page data, there is no good experience. Is there any other way?

<el-button type="success" icon="el-icon-edit" size="mini" @click="updateCurrentRow(scope.row)"></el-button>

//  Home
updateCurrentRow(row) {
this.$http
  .get(this.$api.thelabelQueryId + `?id=${row.id}`)
  .then(res => {
    if (res.status == 200) {
      // this.ruleForm, ?
      this.ruleForm = res.data.data
      this.$router.push({ path: "/addtag", query: { id: row.id } });
    }
  })
  .catch(err => {
    console.log(err);
  });
},

// ?

clipboard.png

Nov.15,2021

use localStorage to save it, then edit the page to read


pass the id to the new page by route, and then send the request to echo the data, so that you will still have the data when you refresh it, because the API will be called again.


or use vuex to set a variable to store the data that needs to be edited
Menu