use vue-router to set the default access to the component, and the content of the component is not displayed
Code sets the default component access path, but the browser interface does not display the problem
related codes
create two js files under the router folder. The first router.js code for one router.js, and one index.js, is as follows:
export const loginRouter = {
path:"/",
name: "login",
title:" login",
meta: {index: 0},
component: () = > import ("@ / components/login.vue")
};
export const routers = [
loginRouter,
]
index.js code is as follows:
import Vue from "vue"
import VueRouter from" vue-router"
import {routers} from". / router"
Vue.use (VueRouter);
const RouterConfig = {
mode: "history",
routers: routers
}
export const router = new VueRouter (RouterConfig);
then the code of main.js is as follows:
import Vue from" vue"
import App from". / App"
import {router} from". / router/index";
import iView from "iview";
Vue.use (iView);
Vue.config.productionTip = false;
new Vue ({
br"-el: < el: > sharpapp", < sharpapp", > sharpapp", h = > sharpapp", < sharpapp", >})
what result do you expect? What is the error message actually seen?
login.vue related code:
< div class= "login" >
<h1></h1>
< / div >
expect to see the interface style implemented in login.vue. Currently, the interface is empty and nothing is displayed. What is the cause of this problem?