Use vuecli to create a vue2 project

1. Open the command line tool and create a new vue project named project

vue create project

2. Install elementUI component library

 npm i element-ui -S

3. Introduce the elementUI component library globally in main.js

import Vue from 'vue';
import ElementUI from 'element-ui';                         //必须要引入
import 'element-ui/lib/theme-chalk/index.css';              //必须要引入
import App from './App.vue';

Vue.use(ElementUI);                                         //必须要引入

new Vue({
  el: '#app',
  render: h => h(App)
});

4. It is convenient to develop css code after installing sass (the version must match the version of node, vue and elementUI)

npm i -D [email protected]  [email protected]  

5. Install vue router (use vue2 version to try to install 3, 4 is not compatible)

npm install [email protected]  //这是我下载的版本

6. Introduce and register routes in main.js

7. Create a router folder by yourself and build an index.js file under it, in which the routing information of the router is written

 

 

Guess you like

Origin blog.csdn.net/weixin_44191318/article/details/127986208