Lost session when using NUxT to develop a project
There is a menu navigation bar at the top of the project, which is made by using some common labels such as H1, and these labels correspond to different routes. The first-level menu is written in H1, and there will be a second-level menu when the mouse hover. The problem is the second-level menu, because the second-level menu is written using NuxT-Link
The page looks something like this
<h1 :class="item.url==fullPath ? 'wid_he_100 actived' : 'wid_he_100 "@ click =" goHref (item. Url) "> {{item. MainTitle}} < / h1 > / / level menu < I class =" down" V-if =" item.childlist. length>0">< li class="zi_list" v-if=" item.childlist. length>0"> V -for="(listItem,idx) in item.childList" :key="idx"> nuxt-link :to="/" +item.url" target="_blank" class="wid_he_100">{{listItem.mainTitle}}</nuxt-link> </li> </ul>Copy the code
The main heading h1 was created because SEO required h1 to use js window.open
The problem is that after logging in, the user information is stored in the session. When the window. Open page is opened, everything in the session is still in nuxT-link.
After much effort, I failed to find the reason. Later, I changed the menu jump mode of the second level to js window.open to open the new window
<li class="zi_list_li" v-for="(listItem,idx) in item.childList" :key="idx" @click="goHref(listitem.url)"> listItem.mainTitle }} </li>Copy the code
This will solve the problem, but still very difficult to understand why the nuxt-link jump can not share the session may need to see the source code to find the answer, small white one, hope big guys more Pointers