h (App),}).$mount('#app');This is the router://router/index.jsimportAffiliateLinksfrom'../modules/affiliate"> "Unregistered Vue route"-PHP Chinese Network Q&A
"Unregistered Vue route"
P粉338969567
P粉338969567 2023-09-11 20:11:48
0
1
319

I'm trying to add a new route to an existing web application:

This is the entry point:

// main.js import router from './router'; ... etc new Vue({ router, ... etc render: (h) => h(App), }).$mount('#app');

This is the router:

// router/index.js import AffiliateLinks from '../modules/affiliate_links/AffiliateLinks.vue'; Vue.use(VueRouter); const routes = [ ... etc { path: '/affiliate-links/client', component: AffiliateLinks, meta: { restricted: 'CLIENT', }, }, ]; const router = new VueRouter({ routes, }); router.beforeEach((to, from, next) => { ... etc // check routes restricted by distribution channel if (to.meta?.restricted && !to.meta.restricted.includes(store.state.user.access.distribution_channel)) { next({ path: '/' }); return; } // user is logged in, allow requested routing next(); }); export default router;

// This is the parent component:

// AffiliateLinks.vue  

// This is the subcomponent:

// AffiliateLinksModal.vue  

Everything looks simple, but when I check the Vue dev tools, I don't see the new route when I click on the component, like

 ... etc 

No response.

P粉338969567
P粉338969567

reply all (1)
P粉605233764

I figured it out.

I finish my work day and commit my changes to the remote repository. That's when I noticed that the changes on the router were gone. I can see the changes in the text editor and in my local Git working changes, but they cannot be pushed to the remote repo.

Worth noting: I deleted the local repository and re-cloned it in the same location, but the problem still exists.

I created a temporary folder and the problem was solved...

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!