T
T
Troodi Larson2021-04-08 23:11:27
Vue.js
Troodi Larson, 2021-04-08 23:11:27

How to change the parameter without re-rendering the component?

Good evening!
There is a route:

{ path: '/trading/:type?', name: i18n.t('menu_trading'), component: Trading, meta: { icon: 'desktop', hideFooter: true, props: true }},

And 2 menu items:
/trading/realand /trading/demo
After the transition with $router.pushor <router-link>, the component is recreated, that is, the create and destroy methods are called.
Is it possible to change :type?without recreating the component?
Since this parameter only changes the value of the variable inside the component, and query cannot be used.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Yarkov, 2021-04-08
@yarkov Vue.js

Try to wrap the keep-alive component and watch on $route.params

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question