I have one header page that has two tabs. The two tabs direct to two different pages. I am using the area
prop that I defined in the header page router view for the system page. It works fine when I am on the system page, but when I go to the product tab and come back to system tab, the prop in the system tab
loses the value. It shows as the string "area"
in the prop. I would like to get the same value when I switch tabs.
<div class="tabs">
<ul>
<li @click="$router.push({ name: 'system' })">
<a>SYSTEM</a>
</li>
<li @click="$router.push({ name: 'product' })">
<a>Product</a>
</li>
</ul>
</div>
<router-view :area="area"/>
</div>
</template>
System view:
export default {
props: ['area'],
Instead of using @click binding you will be much better off using
<router-link>
especially since you are using therouter-view
this will allow you to pass params simply in your app.
https://router.vuejs.org/api/
you declare your routes like so
Then in your code you can build the element simply like so: