{"id":837,"date":"2026-03-06T08:52:41","date_gmt":"2026-03-06T00:52:41","guid":{"rendered":"http:\/\/www.bracku.com\/?p=837"},"modified":"2026-03-11T09:19:02","modified_gmt":"2026-03-11T01:19:02","slug":"uni-app%e4%bd%bf%e7%94%a8echarts%e7%bb%98%e5%88%b6%e6%95%b0%e6%8d%ae%e5%8f%af%e8%a7%86%e5%8c%96%e5%9b%beuniapp%e6%95%b0%e6%8d%ae%e5%88%86%e6%9e%90%e5%9b%be","status":"publish","type":"post","link":"http:\/\/www.bracku.com\/?p=837","title":{"rendered":"uni-app\u4f7f\u7528echarts\u7ed8\u5236\u6570\u636e\u53ef\u89c6\u5316\u56feuniapp\u6570\u636e\u5206\u6790\u56fe"},"content":{"rendered":"\n<p>\u9996\u5148\u6253\u5f00hbuilder\uff0c\u53f3\u952e\u9879\u76ee\u76ee\u5f55<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"650\" height=\"1022\" src=\"http:\/\/www.bracku.com\/wp-content\/uploads\/2026\/03\/image.png\" alt=\"\" class=\"wp-image-838\" srcset=\"http:\/\/www.bracku.com\/wp-content\/uploads\/2026\/03\/image.png 650w, http:\/\/www.bracku.com\/wp-content\/uploads\/2026\/03\/image-191x300.png 191w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><\/figure>\n\n\n\n<p>\u6253\u5f00\u7ec8\u7aef\uff0c\u5e76\u8f93\u5165<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install echarts<\/code><\/pre>\n\n\n\n<p>\u5f15\u5165\u4f9d\u8d56<\/p>\n\n\n\n<p>\u5982\u679c\u60f3\u81ea\u4e3b\u5b66\u4e60\u56fe\u8868\uff0c\u53ef\u4ee5\u53c2\u8003\u4ee5\u4e0b\u4ee3\u7801<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;template>\n  &lt;view>\n    &lt;canvas style=\"height: 30vh;width: 100vw;\" id=\"myEcharts\">&lt;\/canvas>\n  &lt;\/view>\n&lt;\/template>\n&lt;script>\n  import * as echarts from 'echarts';\n\n  export default {\n    data() {\n        return {\n          \/\/ \u8fd9\u91cc\u521d\u59cb\u5316\u4e00\u4e2anull\uff0c\u5f85\u4f1a\u513f\u7528\u6765\u5145\u5f53echarts\u5b9e\u4f8b\n          myChart: null,\n        }\n    },\n    mounted() {\n\t\tthis.myChart = echarts.init(document.getElementById('myEcharts'));\n\t\tlet option = {\n\t\t\txAxis: {\n\t\t\t\ttype: 'category',\n\t\t\t\tdata: &#91;'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']\n\t\t\t},\n\t\t\tyAxis: {\n\t\t\t\ttype: 'value'\n\t\t\t},\n\t\t\tseries: &#91;\n\t\t\t\t{\n\t\t\t\t\tdata: &#91;150, 230, 224, 218, 135, 147, 260],\n\t\t\t\t\ttype: 'line'\n\t\t\t\t}\n\t\t\t]\n\t    };\n\t\tthis.myChart.setOption(option);\n\t\t \n\t    window.addEventListener('resize', () => {\n\t\t    this.myChart.resize()\n\t    });\n    }\n  }\n&lt;\/script><\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u662f\u60f3\u5feb\u901f\u5f15\u7528\u53ef\u4ee5\u53c2\u8003\uff1a<\/p>\n\n\n\n<p><a href=\"https:\/\/blog.csdn.net\/weixin_45966674\/article\/details\/130983948#:~:text=%E8%AF%A5%E6%96%87%E6%8C%87%E5%AF%BC%E5%A6%82%E4%BD%95%E5%9C%A8uni-app%E4%B8%AD%E5%BC%95%E5%85%A5echarts%E5%BA%93%EF%BC%8C%E9%80%9A%E8%BF%87%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%AE%89%E8%A3%85%E4%BE%9D%E8%B5%96%EF%BC%8C%E7%84%B6%E5%90%8E%E4%BB%8Eecharts%E5%AE%98%E7%BD%91%E8%8E%B7%E5%8F%96%E7%A4%BA%E4%BE%8B%E4%BB%A3%E7%A0%81%EF%BC%8C%E5%88%9B%E5%BB%BAcanvas%E7%BB%84%E4%BB%B6%E5%B9%B6%E8%AE%BE%E7%BD%AE%E5%B0%BA%E5%AF%B8%EF%BC%8C%E5%B0%86%E7%A4%BA%E4%BE%8B%E7%9A%84option%E4%BB%A3%E7%A0%81%E5%BA%94%E7%94%A8%E4%BA%8Euni-app%E7%9A%84%E7%BB%84%E4%BB%B6%E4%B8%AD%EF%BC%8C%E5%B1%95%E7%A4%BA%E4%BA%86%E4%B8%80%E4%B8%AA%E7%AE%80%E5%8D%95%E7%9A%84%E7%BA%BF%E5%9B%BE%E3%80%82,%E5%90%8C%E6%97%B6%E5%BC%BA%E8%B0%83%E4%BA%86%E9%9C%80%E4%B8%BA%E7%BB%98%E5%9B%BE%E5%85%83%E7%B4%A0%E8%AE%BE%E7%BD%AE%E5%AE%BD%E5%BA%A6%E5%92%8C%E9%AB%98%E5%BA%A6%EF%BC%8C%E4%BB%A5%E5%8F%8A%E7%9B%91%E5%90%AC%E7%AA%97%E5%8F%A3resize%E4%BA%8B%E4%BB%B6%E4%BB%A5%E9%80%82%E5%BA%94%E5%9B%BE%E8%A1%A8%E5%A4%A7%E5%B0%8F%E3%80%82\">uni-app\u4f7f\u7528echarts\u7ed8\u5236\u6570\u636e\u53ef\u89c6\u5316\u56fe_uniapp echarts\u53ef\u89c6\u5316\u9996\u9009\u7ec4\u4ef6-CSDN\u535a\u5ba2<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148\u6253\u5f00hbuilder\uff0c\u53f3\u952e\u9879\u76ee\u76ee\u5f55 \u6253\u5f00\u7ec8\u7aef\uff0c\u5e76\u8f93\u5165 \u5f15\u5165\u4f9d\u8d56 \u5982\u679c\u60f3\u81ea\u4e3b\u5b66\u4e60\u56fe\u8868\uff0c\u53ef\u4ee5\u53c2\u8003\u4ee5\u4e0b\u4ee3\u7801 \u5982\u679c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-837","post","type-post","status-publish","format-standard","hentry","category-recommend"],"_links":{"self":[{"href":"http:\/\/www.bracku.com\/index.php?rest_route=\/wp\/v2\/posts\/837","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.bracku.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.bracku.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.bracku.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.bracku.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=837"}],"version-history":[{"count":4,"href":"http:\/\/www.bracku.com\/index.php?rest_route=\/wp\/v2\/posts\/837\/revisions"}],"predecessor-version":[{"id":843,"href":"http:\/\/www.bracku.com\/index.php?rest_route=\/wp\/v2\/posts\/837\/revisions\/843"}],"wp:attachment":[{"href":"http:\/\/www.bracku.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=837"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.bracku.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=837"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.bracku.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=837"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}