我有一個父組件,我正在那里查詢后端,然后在導航欄和父組件中的 activeView 數據的幫助下,點擊我呈現一個新的子頁面,并在幫助下從我的響應中傳遞一個道具vue中的v-if。但是該方法的功能之一是更改我在父組件中的道具也改變了我的響應這怎么可能。這是我的子組件的安裝前:beforeMount() { console.log(this.plansPropOrg); this.plansProp = this.plansPropOrg; this.tempPlan = this.plansProp.currentPlan; console.log(this.plansProp); this.propsToData();}有問題的函數是 propsToData 當我在這里注釋掉它是正常的但我必須調用它。這是我進行查詢時的父母:await axios.post("xxxxx/yyyyyyy").then(res => { console.log("heyyo"); console.log(res); this.plansData = res.data.data; console.log(this.plansData); });這是數據的道具,它只是將布爾值翻譯成英文。但是在響應中,(如果這是真的)我將這些值視為翻譯。propsToData() { //TODO: Burdaki if' ifsubscriber olarak de?i?ecel console.log("AAA"); console.log(this.plansProp); if (this.plansProp.isSubscriber) { console.log("BBBBB"); this.plansProp.currentPlan.analytics ? (this.plansProp.currentPlan.analytics = this.$t( "settings.plans.active" )) : (this.plansProp.currentPlan.analytics = this.$t( "settings.plans.inactive" )); } }這怎么可能呢?它怎么能改變反應呢?
VueJs 方法是直接改變一個響應
慕神8447489
2022-10-08 15:01:10