Javascript

12、vue+elementUI (链接版)

本文主要是介绍12、vue+elementUI (链接版),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

链接:https://blog.csdn.net/qq_42025798/article/details/122369907?ops_request_misc=&request_id=&biz_id=102&utm_term=vue最新上手&utm_medium=distribute.pc_search_result.none-task-blog-2

  • 路由配置 index
import Vue from 'vue'
import Router from 'vue-router'
import Main from "../views/Main";
import Login from "../views/Login";

Vue.use(Router);

export default new Router({
  routes:[
    {
      path: '/main',
      name:'main',
      component: Main,
    },
    {
      path: "/login",
      name: 'login',
      component: Login
    }


  ]

});

  • 路由管理
import Vue from 'vue'
import App from './App'
// 扫描路由
import router from './router'
//导入element-ui
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(router);
Vue.use(ElementUI);

new Vue({
  el: '#app',
  // 安装路由
  router,
  render: h => h(App), //elementUi

})
  • app.vue
<template>
  <div id="app">
<router-view></router-view>
  </div>
</template>

<script>


export default {
  name: 'App',

}
</script>

这篇关于12、vue+elementUI (链接版)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!