index.vue 3.54 KB
Newer Older
耿迪迪's avatar
耿迪迪 committed
1 2 3
<template>
  <div>
    <div style="width: 100vw;height: 100vh" id="container"></div>
耿迪迪's avatar
耿迪迪 committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
    <div class="input-card" style='width: 24rem;'>
      <div class="input-item">
        <input type="radio" name='func' checked="" value='marker'><span class="input-text">画点</span>
        <input type="radio" name='func' value='polyline'><span class="input-text">画折线</span>
        <input type="radio" name='func' value='polygon'><span class="input-text" style='width:5rem;'>画多边形</span>
      </div>
      <div class="input-item">
        <input type="radio" name='func' value='rectangle'><span class="input-text">画矩形</span>
        <input type="radio" name='func' value='circle'><span class="input-text">画圆</span>
      </div>
      <div class="input-item">
        <input id="clear" type="button" class="btn" value="清除" />
        <input id="close" type="button" class="btn" value="关闭绘图" />
      </div>
    </div>
耿迪迪's avatar
耿迪迪 committed
19 20 21
  </div>
</template>
<script>
耿迪迪's avatar
耿迪迪 committed
22 23
  import gaodeMap from "utils/gaodeMap.js"
  import {map} from "utils/gaodeMap.js"
耿迪迪's avatar
耿迪迪 committed
24 25
  export default {
    data() {
耿迪迪's avatar
耿迪迪 committed
26 27 28
      return {
        map : null
      };
耿迪迪's avatar
耿迪迪 committed
29 30
    },
    mounted() {
耿迪迪's avatar
耿迪迪 committed
31 32 33 34 35 36 37 38 39 40 41 42
      let gaoMap = new gaodeMap("石家庄");
      let lnglats = [
        [114.497949,38.121129],
        [114.595972,38.114511],
        [114.443193,37.990963],
        [114.588419,37.969449],
        [114.522668,38.042962],
        [114.383966,38.091548]
      ];
      gaoMap.addMarker(lnglats)
      let path = [
        [
耿迪迪's avatar
耿迪迪 committed
43 44 45 46 47
          [114.436698,38.083306],
          [114.57952,38.065468],
          [114.57952,38.002732],
          [114.440131,38.006519],
          [114.436698,38.083306]
耿迪迪's avatar
耿迪迪 committed
48 49
        ],
        [
耿迪迪's avatar
耿迪迪 committed
50 51
          [114.528708,38.075198],
          [114.530768,38.00165]
耿迪迪's avatar
耿迪迪 committed
52 53 54
        ]
      ]
      gaoMap.addPolyline(path);
耿迪迪's avatar
耿迪迪 committed
55
      gaoMap.addMouseTool();
耿迪迪's avatar
耿迪迪 committed
56
      gaoMap.addMapControl();
耿迪迪's avatar
耿迪迪 committed
57 58 59
    }
  };
</script>
耿迪迪's avatar
耿迪迪 committed
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
<style lang="scss" scoped>
  .input-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: #fff;
    background-clip: border-box;
    border-radius: .25rem;
    width: 22rem;
    border-width: 0;
    border-radius: 0.4rem;
    box-shadow: 0 2px 6px 0 rgba(114, 124, 245, .5);
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
    padding: 0.75rem 1.25rem;
  }

  .input-item {
    position: relative;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -ms-flex-align: center;
    align-items: center;
    width: 100%;
    height: 2.2rem;
  }
  input[type=checkbox], input[type=radio] {
    box-sizing: border-box;
    padding: 0;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    padding: 0;
    margin: 0 0.5rem 0 0;
  }
  .btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    border: 1px solid transparent;
    transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    background-color: transparent;
    background-image: none;
    color: #25A5F7;
    border-color: #25A5F7;
    padding: .25rem .5rem;
    line-height: 1.5;
    border-radius: 1rem;
    -webkit-appearance: button;
    cursor:pointer;
    width: 6rem;
    margin: 0 1rem 0 2rem;
  }

  .btn:hover {
    color: #fff;
    background-color: #25A5F7;
    border-color: #25A5F7
  }
  .input-text{
    width: 4rem;
    margin-right:1rem;
  }
</style>
耿迪迪's avatar
耿迪迪 committed
135