Vue-Element-Admins rapid development plan based on vue+element ui front-end framework: vue-element-admin code cloud address , tutorial: vue-element-admin tutorial ;
1. Directory structure
Install node.js and git locally, copy to the local to run, the framework uses mock data by default
# 克隆项目
git clone https://github.com/PanJiaChen/vue-element-admin.git
# 进入项目目录
cd vue-element-admin
# 安装依赖
npm install
# 建议不要用 cnpm 安装 会有各种诡异的bug 可以通过如下操作解决 npm 下载速度慢的问题
npm install --registry=https://registry.npm.taobao.org
# 本地开发 启动项目
npm run dev
The directory of the project of vue scaffolding
├── build # 构建相关
├── mock # 项目mock 模拟数据
├── plop-templates # 基本模板
├── public # 静态资源
│ │── favicon.ico # favicon图标
│ └── index.html # html模板
├── src # 源代码
│ ├── api # 所有请求
│ ├── assets # 主题 字体等静态资源
│ ├── components # 全局公用组件
│ ├── directive # 全局指令
│ ├── filters # 全局 filter
│ ├── icons # 项目所有 svg icons
│ ├── lang # 国际化 language
│ ├── layout # 全局 layout
│ ├── router # 路由
│ ├── store # 全局 store管理
│ ├── styles # 全局样式
│ ├── utils # 全局公用方法
│ ├── vendor # 公用vendor
│ ├── views # views 所有页面
│ ├── App.vue # 入口页面
│ ├── main.js # 入口文件 加载组件 初始化等
│ └── permission.js # 权限管理
├── tests # 测试
├── .env.xxx # 环境变量配置
├── .eslintrc.js # eslint 配置项
├── .babelrc # babel-loader 配置
├── .travis.yml # 自动化CI配置
├── vue.config.js # vue-cli 配置
├── postcss.config.js # postcss 配置
└── package.json # package.json
Two, use
First create the router route, create yzg.js under /router/modules, introduce the layout layout, add sub-nodes to redirect to the component, the path is /views/yzgs/test.vue, add the route import in /router/index.js , And added to the constantRouter;
import Layout from '@/layout'
const yzgTest = {
path: '/yzgs',
component: Layout,
redirect: 'noRedirect',
name: 'yzgs',
meta: {
title: '叶宗刚',
icon: 'table'
},
children: [
{
path: 'test',
component: () => import('@/views/yzgs/test.vue'),
name: 'test',
meta: { title: '测试' }
}
]
}
export default yzgTest
In /views/yzgs/test.vue,
<template>
<div>
<h1>
你好
</h1>
</div>
</template>
<script>
</script>
This page is added through a static route;