关于#ArcGIS#的问题:日常足采坑的最后一步数据类型错误

简单来说我使用ARCGIS绘画了坐标图出来,然后保存了起来,传到前端想要定位在图层上把图画出来,需求是画的是线

img


这是我保存的数据,然后他给我报数据类型不对

img


所以我用我写死的位置坐标试了一下

img

画出来了.我百思不得其解,最后只能归结于我保存的数组是在一个对象里,而写死的数据是数组本身!有人能告诉我怎么办嘛 附上我的代码,以下是我的方法 :用vscode写的 技术是vue-cli搭的项目elementui的模板

 Locate(){
      console.log('value');
      console.log(this.select)//后台读到的值
      var rings=[]//准备坐标放的容器
         this.view.graphics.removeAll()
        //传入坐标点
      this.select.forEach(item => {
        console.log("itemZZ");
       console.log(item);

       rings.push( [item[0],item[1]])
      });
    
      console.log(rings);
        //图形数据属性
      this.dkShape = {
          type: 'polyline',//图形样式(如:多边形,线,点) polyline线  polygon图
          paths:rings,
          //数据坐标 rings 图 paths线
          //spatialReference: { wkid: 4326 } 空间参考坐标系
        }
    
      //       let polyline = {
      //               type: "polyline",  // autocasts as new Polyline()
      //               paths: [
      //               [-111.30, 52.68],//写死的可以画出来
      //               [-98, 49.5],
      //               [-93.94, 29.89]
      //             ]
      // };
        let polylineSymbol = {
          type: "simple-line",  // autocasts as SimpleLineSymbol() simple-fill填充图 simple-line线
           color: [170,138,88],
          width: 4
        };
        this.polylineAtt={
          name:"自定义的图斑绘画"
        }
          let polylineGraphic = new this.esriModules.Graphic({
           // geometry: this.dkShape,   //图形数据样式polyline
              geometry:this.dkShape,
            symbol: polylineSymbol,  //标识绘画的图斑的样式
           // attributes: this.polylineAtt  //图形带的数据
          });

这个错误是v-for循环的key被设置遍历的值了,而值是对象,不是string或者number类型的。题主的app.vue改下key的内容
类似

<div v-for="(item,index) in list" :key="item">
改为
<div v-for="(item,index) in list" :key="index">

参考:

我的问题是,不知道为什么我用写死的数据可以绘画出线条,但是传进来的数据不行

其实是因为数组后面有_ob_,JSON.stringify(JSON.parse(data))就好了