Why is the method written by yourself modified to the data returned by the background?

    
   
   self.$ajax
      .get("/api/http/shop/searchShop.jhtml", {
        params: {
          shopId: src[5]
        },
      })
      .then(function(response) { 
    
    // console.log(response);

    self.detailForm = response.data.result;
    console.log(response.data.result.phone)

    self.detailForm.phone  = Utils.iphoneSymbol(self.detailForm.phone);

    console.log(response.data.result.phone)
    }
   }

clipboard.png

Mar.11,2021

should be a problem of deep and shallow copies, and then learn about the problems of reference types and basic types


points to the same data source


self.detailForm is not a variable, so the data it points to is response.data.result.
self.detailForm.phone is formatted here equals response.data.result.phone is formatted


js has such a feature, if you assign a value b to a variable and the value is an object literal such as {key:100}, then you modify the key property of the assigned variable a, then b will change accordingly, but if you assign a value c, then b will not change. Complex type data variables are essentially pointers. If you modify the internal properties of the variable, you will directly modify the value in memory that the pointer points to, so another value that also points to that address will change. But if you re-assign the value, then the variable a will re-point to another address, that's all. Note that the basic type is not a pointer

.
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-1e5a69e-4d945.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-1e5a69e-4d945.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?