webguicai opened a new issue, #18036:
URL: https://github.com/apache/echarts/issues/18036

   ### Version
   
   5.4.0
   
   ### Link to Minimal Reproduction
   
   _No response_
   
   ### Steps to Reproduce
   
   @leeight @bantic 
   `<!-- 
http://datav.aliyun.com/portal/school/atlas/area_selector#&lat=24.9792116201569&lng=104.86930847167969&zoom=10
 -->
   
   <!-- 引入vue -->
   <script src="https://unpkg.com/vue@3/dist/vue.global.js";></script>
   <!-- 引入echarts -->
   <script 
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts.min.js";></script>
   <!-- 引入axios -->
   <script src="https://unpkg.com/axios/dist/axios.min.js";></script>
   
   
   <!-- 我是dom -->
   <div id="app" v-cloak>
       <div ref="echart" class="chart" style="width: 98vw; height: 98vh"></div>
   </div>
   
   
   
   
   <script type="module">
       const { createApp } = Vue;
   
       createApp({
           data() {
               return {
                   echartIns: null,
               };
           },
           mounted() {
               // 初始化echarts
               this.echartIns = echarts.init(this.$refs.echart);
               this.renderChart();
           },
           methods: {
               async renderChart(code) {
                   this.echartIns.off("click");
                   const geoJson = await this.getMap(code);
                   echarts.registerMap("map", geoJson.data);
                   const option = {
                       geo: {
                           map: 'map',
                           zoom: 1,
                           silent: true,
                           regions: [  // 此处为最后一个对应的json时出现bug,单独赋予其他城市都没有问题
                               {
                                   name: '桐乡市',
                                   itemStyle: {
                                       opacity: 1,
                                       borderColor: '#fff',
                                       borderWidth: 1,
                                       areaColor: 'green',
                                   },
                               },
                           ],
                           itemStyle: {
                               areaColor: 'rgba(0,0,0,0)',
                           },
                       },
                       series: [
                           {
                               name: '地图',
                               type: 'map',
                               map: 'map',
                               zoom: 1,
                               itemStyle: {
                                   color: 'blue',
                                   emphasis: {
                                       areaColor: '#fff',
                                   },
                                   areaColor: {
                                       type: 'radial',
                                       x: 0.5,
                                       y: 0.5,
                                       r: 0.8,
                                   },
                               },
                           },
                       ],
                   };
                   this.echartIns.setOption(option);
                   // 点击获取下一级地图
                   this.echartIns.on("click", (msg) => {
                       const cityMsg = geoJson.data.features.find(
                           (item) => item.properties.name === msg.name
                       ).properties;
                       this.renderChart(
                           cityMsg.adcode + (cityMsg.childrenNum > 0 ? "_full" 
: "")
                       );
                   });
               },
               // 获取地图数据
               getMap(code = "330400_full") {
                   return axios.get(
                       
`https://geo.datav.aliyun.com/areas_v3/bound/geojson?code=${code}`
                   );
               },
           },
       }).mount("#app");
   </script>
   <style>
       [v-cloak] {
           display: none;
       }
   
       html::-webkit-scrollbar {
           display: none;
       }
   </style>`
   
   ### Current Behavior
   
   map地图regions当所需变色为地图Json最后一个对象时所有区域都会变成最后一个赋予的颜色 @leeight @bantic 
   
   ### Expected Behavior
   
   对应块给予对应的颜色
   @leeight @bantic 
   
   ### Environment
   
   ```markdown
   - OS:
   - Browser: google
   - Framework:
   ```
   
   
   ### Any additional comments?
   
   这两天需要发布,请帮忙看一下,尽快修复


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to