기본 개체를 포함하는 구성 요소가 있고 생성시 채워진 개체가 생깁니다. this.profile을 새로운 객체에 바인드하려고 할 때 메소드에서 올바른 데이터를 얻는 것처럼 보이지만 변경 사항은 this.profile의 다른 용도로 푸시되지 않습니다. 스크립트의 나머지 부분에서이 변경 사항을 강제 적용 할 수있는 방법이 있습니까?Gue 뒤에 Vue.js 구성 요소 데이터가 업데이트되지 않습니다.
export default {
data() {
return {
profile: {
firstName: 'Seller First Name',
surname: 'Seller Surname',
username: '',
biography: 'Seller biography.',
phoneNumber: 'Seller Phone Number',
emailAddress: 'Seller Email',
profilePhotoUrl: '',
testimonials: []
}
};
},
components: {
ProfileSummary,
Biography,
TestimonialList,
PaymentsenseCompany
},
created() {
console.log('created');
this.getProfile(this.$route.params.sellerUsername);
},
methods: {
getProfile(sellerUsername) {
axios.get('http://fieldsellerprofileapi.azurewebsites.net/api/fieldseller/' + sellerUsername)
.then(function(response) {
this.profile = Object.assign({}, response.data);
Vue.nextTick(() => {
console.log('after', this);
});
}.bind(this))
.catch(e => {
console.log(e);
// location.replace('/404');
});
}
},