后台管理 的完结
在这个项目后台管理项目做完 学到了很都的东西 !
1:学到的就是 配置路由的 懒加载 之前我们配置路由 都是
import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";
import Login from "@/views/login";
import userList from '@/views/userlist'
都是这样配置的 学了这个后台管理 就学会了 路由懒加载 实现路由的跳转
//路由懒加载
const role=()=>import('@/views/role')
const permissions=()=>import('@/views/permissions')
const shangpin=()=>import('@/views/shangpin')
const sj=()=>import('@/views/sj')
const about=()=>import('@/views/about')
const orderlist=()=>import('@/views/orderlist')
const goodsadd=()=>import('@/views/goodsadd')
const commodity=()=>import('@/views/commodity')
const classificationlist=()=>import('@/views/classificationlist')
Vue.use(VueRouter);
使用路由之后懒加载的优点
在单页应用中,如果没有应用懒加载,运用webpack打包后的文件将会异常的大,
造成进入首页时,需要加载的内容过多,延时过长,不利于用户体验,
运用懒加载可以将页面进行划分,按需加载页面,可以分担首页所承担的加载压力,减少加载用时。
然后呢 在这个项目中呢 我还学了一个 插件 就是做一些股票了
一些数据了 ,都可以使用 ECharts 这个插件 非常不错
使用 ECharts
通过 npm 获取 echarts
1:第一步
npm install echarts --save,下载
2:第二步
import echarts from "echarts" 引入`
3:第三步
<div id="main" style="width: 750px;height:400px;"></div>
4:第四步
export default {
methods: {
init: function() {
// 基于准备好的dom,初始化echarts实例
let myChart = this.$echarts.init(document.getElementById("main"));
},
mounted() {
// 调用这个方法
this.init();
}
5 :第五步
// 指定图表的配置项和数据
let option = {
title: {
text: "用户来源"
},
tooltip: {
trigger: "axis",
axisPointer: {
type: "cross",
label: {
backgroundColor: "#6a7985"
}
}
},
legend: {
data: ["华东", "华南", "华北", "西部", "其他"]
},
toolbox: {
feature: {
saveAsImage: {}
}
},
grid: {
left: "3%",
right: "4%",
bottom: "3%",
containLabel: true
},
xAxis: [
{
type: "category",
boundaryGap: false,
data: [
"2017-12-27",
"2017-12-28",
"2017-12-29",
"2017-12-30",
"2017-12-31",
"2018-1-1",
"2018-1-2"
]
}
],
yAxis: [
{
type: "value"
}
],
series: [
{
name: "华东",
type: "line",
stack: "总量",
areaStyle: {},
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: "华南",
type: "line",
stack: "总量",
areaStyle: {},
data: [220, 182, 191, 234, 290, 330, 310]
},
{
name: "华北",
type: "line",
stack: "总量",
areaStyle: {},
data: [150, 232, 201, 154, 190, 330, 410]
},
{
name: "西部",
type: "line",
stack: "总量",
areaStyle: {},
data: [320, 332, 301, 334, 390, 330, 320]
},
{
name: "其他",
type: "line",
stack: "总量",
label: {
normal: {
show: true,
position: "top"
}
},
areaStyle: {},
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
]
};
6:第六步
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
最后呢 在这个项目中呢 让我对这个element 这个组件的更家 的连接熟练的使用这个ui框架