this.$set的正確使用


this.tableData.forEach((item, index) => {
                let ZKprice = (item.price * this.discount * 0.1).toFixed(2);
// 要修改的數據 索引 要改的值 三個參數
this.$set(this.tableData, index, { ZKprice: ZKprice, SetPrice: this.discount, limit_stock: item.limit_stock }); });

 

textJsona: function () {
            let vm = this
            let textJson300 = [
                {t1: 't1',t2: 't2',t3: 't3'},
                {t4: 't4',t5: 't5',t6: 't6'},
                {t7: 't7',t8: 't8',t9: 't9'},
            ]
          vm.$set(vm.textJson[1],'t5',textJson300[1].t5) 
            //此時等效於 vm.$set(vm,'textJson',textJson300)
        }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM