如果你非要在computed中访问this,可以通过下面这个hack,可以用个flag来判断
data() {
return {
isMounted: false,
}
}
computed: {
nameAndPhone() {
if (!this.isMounted) return
const {
reservationName,
reservationPhone
} = this.$refs.appointment.getFormValue()
return reservationPhone
? reservationName + '/' + reservationPhone
: reservationName
}
},
mounted() {
this.isMounted = true
},