Is there a way to retrieve the value of props
using lifecycle hooks such as mounted
or updated
, and then store that value in my v-model
with additional text? I've been struggling to achieve this.
I attempted using :value
on the input element with both the props
value and some string, and it did work. However, it appears that I cannot access it without using v-model
. From my research, it seems like you can't use both v-model
and :value
simultaneously.
The goal is to obtain the combined value
(from props and extra strings) from the input
tags.
Parent Component
<invite :user_token="user_token"/>
Child Component
export default {
props: ['user_token'],
data() {
return {
link: ''
}
},
mounted() {
console.log(this.user_token);
this.link = `"http://localhost/johndoe-vue/public/#/invite${this.user_token}"`;
},
updated() {
console.log(this.user_token);
this.link = `"http://localhost/johndoe-vue/public/#/invite${this.user_token}"`;
}
}