echarts.vue 979 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <div :id="id" :style="{width:width, height:height }"></div>
  3. </template>
  4. <script>
  5. export default{
  6. name:"testStateMent",
  7. props:{
  8. width:{
  9. default:"400px",
  10. type:String
  11. },
  12. height:{
  13. default: "600px",
  14. type:String
  15. },
  16. id:{
  17. default:"echarts",
  18. type:String
  19. },
  20. options:{
  21. defalut:{},
  22. type:Object
  23. }
  24. },
  25. data(){
  26. return {
  27. }
  28. }
  29. ,mounted() {
  30. const statis = this.$echarts.init(document.getElementById(this.id),'dark')
  31. this.options = {
  32. title: {
  33. text: 'ECharts 入门示例'
  34. },
  35. tooltip: {},
  36. legend: {
  37. data: ['销量']
  38. },
  39. xAxis: {
  40. data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
  41. },
  42. yAxis: {},
  43. series: [
  44. {
  45. name: '销量',
  46. type: 'bar',
  47. data: [5, 20, 36, 10, 10, 20]
  48. }
  49. ]
  50. }
  51. statis.setOption(this.options)
  52. }
  53. }
  54. </script>