1. 程式人生 > >Observer(__ob__: Observer) 對象添加屬性

Observer(__ob__: Observer) 對象添加屬性

then aws ups 添加屬性 foreach 得到 通過 bsp att

重點通過這句話給對象添加屬性:

this.$set(r,‘upshow‘,false);

在data中定義laws來裝從接口中請求到數據

 data(){
            return{
                laws:[],//法律依據
            }
 },

 _getAttachment(){
                getAttachment(
                    {attachment_id: this.attachment_id},
                    {Authorization: this.access_token}
                ).then( (res)
=>{this.laws = res.content.laws; //得到的數據賦值給lawsthis.laws.forEach((r)=>{ //循環遍歷laws對象 分別一一賦值新對象 this.$set(r,‘upshow‘,false); //重點是這句話。(對象,屬性,屬性值) }) }) },

此時law返回是的

技術分享圖片

展開:

技術分享圖片

成果:

技術分享圖片

Observer(__ob__: Observer) 對象添加屬性