Add vue-charts component

This commit is contained in:
lin-xin 2017-02-20 19:01:37 +08:00
parent b0a8a2dac2
commit beec461322
5 changed files with 51 additions and 6 deletions

View File

@ -10,7 +10,9 @@
}, },
"dependencies": { "dependencies": {
"axios": "^0.15.3", "axios": "^0.15.3",
"chart.js": "^2.5.0",
"element-ui": "^1.1.6", "element-ui": "^1.1.6",
"hchs-vue-charts": "^1.2.7",
"vue": "^2.1.10", "vue": "^2.1.10",
"vue-core-image-upload": "^2.0.5", "vue-core-image-upload": "^2.0.5",
"vue-datasource": "^1.0.4", "vue-datasource": "^1.0.4",

View File

@ -14,11 +14,8 @@
<el-menu-item index="upload">文件上传</el-menu-item> <el-menu-item index="upload">文件上传</el-menu-item>
</el-submenu> </el-submenu>
<el-submenu index="3"> <el-submenu index="3">
<template slot="title"><i class="el-icon-star-on"></i>UI元素</template> <template slot="title"><i class="el-icon-star-on"></i>图表</template>
<el-menu-item index="3-1">弹出框alert</el-menu-item> <el-menu-item index="vuecharts">VueCharts</el-menu-item>
<el-menu-item index="3-2">确认框confirm</el-menu-item>
<el-menu-item index="3-3">提示框</el-menu-item>
<el-menu-item index="3-4">树形图</el-menu-item>
</el-submenu> </el-submenu>
</el-menu> </el-menu>
</div> </div>

View File

@ -0,0 +1,40 @@
<template>
<div>
<div class="crumbs">
<el-breadcrumb separator="/">
<el-breadcrumb-item><i class="el-icon-date"></i> 图表</el-breadcrumb-item>
<el-breadcrumb-item>VueCharts</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="plugins-tips">
vue-charts基于vue2和chart.js的图表组件
访问地址<a href="https://github.com/hchstera/vue-charts" target="_blank">vue-charts</a>
</div>
<chartjs-line class="chart-box"
:datalabel="mylabel" :labels="mylabels" :data="mydata"
:linetension="0"></chartjs-line>
<chartjs-bar class="chart-box"
:datalabel="mylabel" :labels="mylabels" :data="mydata"></chartjs-bar>
</div>
</template>
<script>
export default {
data: function(){
return {
mylabel : '2013-2017年走势',
mylabels : ['2013','2014','2015', '2016', '2017'],
mydata : [15,30, 20, 80, 100]
}
}
}
</script>
<style>
.chart-box{
float: left;
width:500px;
margin: 20px 30px;
}
</style>

View File

@ -1,11 +1,13 @@
import Vue from 'vue'; import Vue from 'vue';
import App from './App'; import App from './App';
import router from './router'; import router from './router';
require('chart.js/dist/Chart.bundle.min.js')
require('hchs-vue-charts/dist/vue-charts.js')
import ElementUI from 'element-ui'; import ElementUI from 'element-ui';
import 'element-ui/lib/theme-default/index.css'; import 'element-ui/lib/theme-default/index.css';
Vue.use(ElementUI); Vue.use(ElementUI);
Vue.use(VueCharts);
new Vue({ new Vue({
router, router,
render: h => h(App) render: h => h(App)

View File

@ -28,6 +28,10 @@ export default new Router({
{ {
path: '/upload', path: '/upload',
component: resolve => require(['../components/page/Upload.vue'], resolve) component: resolve => require(['../components/page/Upload.vue'], resolve)
},
{
path: '/vuecharts',
component: resolve => require(['../components/page/VueCharts.vue'], resolve)
} }
] ]
}) })