|
@@ -109,6 +109,7 @@
|
|
|
<!-- bottomBox end -->
|
|
|
</section>
|
|
|
</template>
|
|
|
+
|
|
|
<script>
|
|
|
import statisTop from "./components/statisTop";
|
|
|
import statisBottom from "./components/statisBottom";
|
|
@@ -499,22 +500,18 @@ export default {
|
|
|
//加载行政区划插件
|
|
|
if (!this.district) {
|
|
|
//实例化DistrictSearch
|
|
|
- // alert(1)
|
|
|
-
|
|
|
+ var that=this
|
|
|
AMap.plugin("AMap.DistrictSearch", function () {
|
|
|
- this.district = new AMap.DistrictSearch({
|
|
|
+ that.district = new AMap.DistrictSearch({
|
|
|
subdistrict: 0, //获取边界不需要返回下级行政区
|
|
|
extensions: "all", //返回行政区边界坐标组等具体信息
|
|
|
level: "district", //查询行政级别为 市
|
|
|
});
|
|
|
- alert(2)
|
|
|
- console.log('this.district');
|
|
|
- console.log(this.district);
|
|
|
|
|
|
//行政区查询
|
|
|
- this.district.search("嘉定区", function (status, result) {
|
|
|
- this.map.remove(this.polygons); //清除上次结果
|
|
|
- this.polygons = [];
|
|
|
+ that.district.search("嘉定区", function (status, result) {
|
|
|
+ that.map.remove(that.polygons); //清除上次结果
|
|
|
+ that.polygons = [];
|
|
|
var bounds = result.districtList[0].boundaries;
|
|
|
if (bounds) {
|
|
|
for (var i = 0, l = bounds.length; i < l; i++) {
|
|
@@ -522,15 +519,15 @@ export default {
|
|
|
var polygon = new AMap.Polygon({
|
|
|
strokeWeight: 1,
|
|
|
path: bounds[i],
|
|
|
- fillOpacity:1,
|
|
|
- fillColor: "green",
|
|
|
- strokeColor: "green",
|
|
|
+ fillOpacity:.2,
|
|
|
+ fillColor: "pink",
|
|
|
+ strokeColor: "pink",
|
|
|
});
|
|
|
- this.polygons.push(polygon);
|
|
|
+ that.polygons.push(polygon);
|
|
|
}
|
|
|
}
|
|
|
- this.map.add(this.polygons);
|
|
|
- this.map.setFitView(this.polygons); //视口自适应
|
|
|
+ that.map.add(that.polygons);
|
|
|
+ that.map.setFitView(that.polygons); //视口自适应
|
|
|
});
|
|
|
});
|
|
|
}
|