vue兩次賦值頁面獲取不到的解決
更新時(shí)間:2022年04月23日 10:37:09 作者:問馫
這篇文章主要介紹了vue兩次賦值頁面獲取不到的解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
兩次賦值頁面獲取不到
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));?
vue賦值不成功問題
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);
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
Vue中 key keep-alive的實(shí)現(xiàn)原理
這篇文章主要介紹了Vue中 key keep-alive的實(shí)現(xiàn)原理,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-09-09Vue關(guān)于組件化開發(fā)知識(shí)點(diǎn)詳解
在本篇文章里,小編給大家分享的是關(guān)于Vue關(guān)于組件化開發(fā)知識(shí)點(diǎn)詳解內(nèi)容,有興趣的朋友們可以學(xué)習(xí)下。2020-05-05vscode 開發(fā)Vue項(xiàng)目的方法步驟
這篇文章主要介紹了vscode 開發(fā)Vue項(xiàng)目的方法步驟,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-11-11vue.js element-ui tree樹形控件改iview的方法
這篇文章主要介紹了vue.js element-ui tree樹形控件改iview的方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-03-03Vue解決element-ui消息提示$message重疊問題
這篇文章主要為大家介紹了Vue解決element-ui消息提示$message重疊問題,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-08-08解決ele ui 表格表頭太長問題的實(shí)現(xiàn)
這篇文章主要介紹了解決ele ui 表格表頭太長問題的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-11-11