How to use router after the simple introduction of vuejs and vue-routerjs?

clipboard.png

as shown in the figure, the directory structure is generally .html files, how to configure route redirection? Now the project is written in es5, seniors give me a comment or demo, thank you very much ^ _ ^

Jq
const router = new VueRouter({
  mode: "history",
  base: __dirname,
  routes: [
    { path: "/", component: Home },
    { path: "/foo", component: Foo },
    { path: "/bar", component: Bar }
  ]
})

if it is not a vue cli project

only vue.js single files are introduced

vue router is not recommended for route redirection

you can see those functions in the official documents

// 0. VueVueRouter Vue.use(VueRouter)

// 1.  () 
//  import 
const Foo = { template: '<div>foo</div>' }
const Bar = { template: '<div>bar</div>' }

// 2. 
//  "component" 
//  Vue.extend() 
// 
// 
const routes = [
  { path: '/foo', component: Foo },
  { path: '/bar', component: Bar }
]

pay attention to Foo Bar


vue-router is for single page applications
you are all html directly a tag jump or window.location.href jump on the line


Hello, have you solved your problem? Could you tell me about the solution, please?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea68fd-1de3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea68fd-1de3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?