您好,登錄后才能下訂單哦!
這篇文章主要介紹“vue兩次賦值頁面獲取不到怎么解決”的相關(guān)知識,小編通過實(shí)際案例向大家展示操作過程,操作方法簡單快捷,實(shí)用性強(qiáng),希望這篇“vue兩次賦值頁面獲取不到怎么解決”文章能幫助大家解決問題。
vue兩次賦值console.log出來的值為第二次賦的值爾頁面顯示的是第一次賦的值
getform(){ //api3 var _this=this var formSchemad=_this.formSchema console.log(_this.formSchema) axios({ method:'get', url:'odoo/mobile/api3/jsonui?id=xxxx' }).then(function(resp){ formSchemad=JSON.parse(resp.data); console.log(formSchemad) _this.formSchema=formSchemad; //第一次賦值 axios({ method:'get', url:'odoo/mobile/api3/jsonui?id=xxxx_100' }).then(function(respd){ _this.cdis=false var mont=JSON.parse(respd.data); var montname=[] var montvalue=[] console.log(mont) for(var i=0;i<mont.length;i++){ montname.push(mont[i].name); montvalue.push(mont[i].value); formSchemad.properties[mont[i].name].value=mont[i].value; } console.log(formSchemad) _this.formSchema=formSchemad; //第二次賦值
將兩次賦值改為一次
將賦值的代碼改為
_this.formSchema= json.parse(json.stringify(formSchemad));
data(){ applyFormMetaData:{ "name":"jack", "discounted_profit":0, } } var discounted_profit = 300; // 普通賦值 this.applyFormMetaData.discounted_profit = discounted_profit; // vue提供的方法重新顯示聲明 this.$set(this.applyFormMetaData, 'discounted_profit', discounted_profit);
關(guān)于“vue兩次賦值頁面獲取不到怎么解決”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識,可以關(guān)注億速云行業(yè)資訊頻道,小編每天都會為大家更新不同的知識點(diǎn)。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。