0

I just want one help. Here I have AccountAdmin.vue file is there. In that file, I am requesting parameter from router.push. I got parameter in URL, but problem is that in props, parameter not set first when I load the tab-content. First the props are called and then created() is called. So, I can get parameter from query in myParam, but I need those parameters before props are called. Is there anyway to for this?

AccountAdmin.vue

function expandView(myParam1) {  
if(myParam1 !== ''){  
return 'combine';  
}  
return 'nonCombine';

export default {  
name: 'accounts-admin',  
created() {  
if(this. $route.query.myParam ) {  
const myParam1 = this. $route.query.myParam;  
}  
else{  
console. log('parameter not available');  
}

props: {  
currentTabIndex: {  
type: String, default) {  
let myParam1 = ‘’;  
if(myParam1! =='') {  
myParam1 = this. $route.query.myParam;  
return expandView(myParam1);  
}  
else{  
return  
'nonCombine';  
}  
},  
}

Editfile.vue

handLeSubmitCallback({error}) {  
this $router•push({path: '/administration', query: { myParam:’abc’}});

I can get parameter from query in myParam, but I need those parameters before props are called. Is there anyway to do for this?

2
  • Usually you react to the changes rather than hack the order or it with reactive conditionals. Commented Jun 13, 2024 at 7:27
  • This means that currentTabIndex shouldn't be a prop but reactive data. Also see router.vuejs.org/guide/essentials/passing-props#Function-mode , prop mapping needs to be done at route level rather than component Commented Jun 13, 2024 at 9:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.