## echarts的使用
1.脚手架搭建vue项目
2.安装echarts
~~~
npm install echarts --save
~~~
3.main.js引入
~~~
import echarts from 'echarts';
Vue.prototype.$echarts = echarts;
~~~
4.具体页面使用
```
<style scoped>
h2{
text-align: center;
padding: 30px;
font-size: 18px;
}
#chart_example{
width: 50%;
height: 500px;
border: 1px solid red;
margin: 0 auto;
}
</style>
<template>
<div>
<h2>vue中插入Echarts示例</h2>
<div id="chart_example">
</div>
</div>
</template>
<script>
import echarts from 'echarts'
export default {
data() {
return {}
},
mounted() {
let this_ = this;
let myChart = echarts.init(document.getElementById('chart_example'));
let option = {
color: ['#f44'],
tooltip : {
trigger: 'axis',
axisPointer : {
type : 'shadow'
}
},
xAxis : [
{
type : 'category',
data : ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月',],
axisTick: {
alignWithLabel: true
}
}
],
yAxis : [
{
type : 'value'
}
],
series : [
{
name:'每月花费',
type:'bar',
barWidth: '60%',
data:[995,666,444,858,654,236,645,546,846,225,547,356]
}
]
};
myChart.setOption(option);
//建议加上以下这一行代码,不加的效果图如下(当浏览器窗口缩小的时候)。超过了div的界限(红色边框)
window.addEventListener('resize',function() {myChart.resize()});
},
methods: {},
watch: {},
created() {
}
}
</script>
```
- vs code 所需插件
- 新建项目基础配置
- 新项目初始化
- 项目打包上传
- 适配
- vue-vw
- vue-rem
- 基础
- 跳转
- 循环
- 样式
- 组件
- 子组件自定义事件向父组件传参
- 兄弟组件之间传参(含vuex)
- 实例:实现子组件word、list之间的参数传递
- 父子组件
- vuex的使用
- 精简版(不经过action)
- 组件实例(axios+http)
- axios读取网络数据
- MovieItem组件
- swiper
- better-scroll
- position:fixed搭配使用
- 数据绑定
- 计算属性
- 计算属性(computed)与监听属性(watch)搭配使用
- 侦听
- 动画
- 原理
- 使用iconfont
- 雪碧图
- 插槽
- @import引入外部样式
- 路径配置
- ref属性
- 显示隐藏的控制
- 生命周期
- 数据请求
- vuex
- 小效果
- 1.下滑顶部标题显示
- 2.在页面初始时加入动画效果
- 小项目
- Vue搜索功能
- Vue电影数据获取渲染
- Vue-travel
- main.js
- HTTP.js
- Head.vue
- swiper.js
- Home.vue
- 小技巧
- 1.阻止双击页面图片放大
- 2.缓存设置
- 3.跳转页面后从顶部开始显示
- 4.打包
- 5.使用store.js中的数据
- 使用库
- vant
- vant-list
- weex(实现vue代码编写Android软件)
- 1.启动项目
- 2.搭配Android studio
- vuex
- 1.State
- 2.Getter
- 3.Mutation
- 注
- 使用echarts
- echarts更换主题
