@styzy/vue-amap 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/vue-amap.common.js +148 -83
- package/lib/vue-amap.common.js.map +1 -1
- package/lib/vue-amap.umd.js +148 -83
- package/lib/vue-amap.umd.js.map +1 -1
- package/lib/vue-amap.umd.min.js +1 -1
- package/lib/vue-amap.umd.min.js.map +1 -1
- package/package.json +1 -1
package/lib/vue-amap.umd.js
CHANGED
|
@@ -32,7 +32,7 @@ ___CSS_LOADER_EXPORT___.push([module.id, ".v-amap-ctn[data-v-0a8871e0],.v-amap-c
|
|
|
32
32
|
|
|
33
33
|
/***/ }),
|
|
34
34
|
|
|
35
|
-
/***/
|
|
35
|
+
/***/ 543:
|
|
36
36
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
37
37
|
|
|
38
38
|
"use strict";
|
|
@@ -46,14 +46,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
46
46
|
|
|
47
47
|
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
|
|
48
48
|
// Module
|
|
49
|
-
___CSS_LOADER_EXPORT___.push([module.id, ".v-amap-place-search-input input[data-v-
|
|
49
|
+
___CSS_LOADER_EXPORT___.push([module.id, ".v-amap-place-search-input[data-v-0b77a6ce]{position:relative}.v-amap-place-search-input input[data-v-0b77a6ce]{display:inline-block;box-sizing:border-box;padding:0 15px;width:100%;height:40px;outline:0;border:1px solid #dcdfe6;border-radius:4px;background-color:#fff;background-image:none;color:#606266;font-size:inherit;line-height:40px;transition:border-color .2s cubic-bezier(.645,.045,.355,1);-webkit-appearance:none}.v-amap-place-search-input input[data-v-0b77a6ce]::-webkit-input-placeholder{color:#c0c4cc}.v-amap-place-search-input input.is-disabled[data-v-0b77a6ce]{border-color:#e4e7ed;background-color:#f5f7fa;color:#c0c4cc;cursor:not-allowed}.v-amap-place-search-input .option-ctn[data-v-0b77a6ce]{position:absolute;top:100%;right:0;left:0;z-index:1;box-sizing:border-box;border:1px solid #dcdfe6;background-color:#fff}.v-amap-place-search-input .option-ctn .option[data-v-0b77a6ce]{overflow:hidden;padding-right:5px;padding-left:15px;height:40px;text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:40px;cursor:pointer}.v-amap-place-search-input .option-ctn .option[data-v-0b77a6ce]:hover{background-color:#f4f5f6}.v-amap-place-search-input .option-ctn .option .name[data-v-0b77a6ce]{color:#424242}.v-amap-place-search-input .option-ctn .option .city[data-v-0b77a6ce]{margin-left:10px;color:#aaa}", ""]);
|
|
50
50
|
// Exports
|
|
51
51
|
/* harmony default export */ __webpack_exports__["default"] = (___CSS_LOADER_EXPORT___);
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
/***/ }),
|
|
55
55
|
|
|
56
|
-
/***/
|
|
56
|
+
/***/ 354:
|
|
57
57
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
58
58
|
|
|
59
59
|
"use strict";
|
|
@@ -194,35 +194,35 @@ var update = add("1bf2dbec", content, true, {"sourceMap":false,"shadowMode":fals
|
|
|
194
194
|
|
|
195
195
|
/***/ }),
|
|
196
196
|
|
|
197
|
-
/***/
|
|
197
|
+
/***/ 453:
|
|
198
198
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
199
199
|
|
|
200
200
|
// style-loader: Adds some css to the DOM by adding a <style> tag
|
|
201
201
|
|
|
202
202
|
// load the styles
|
|
203
|
-
var content = __webpack_require__(
|
|
203
|
+
var content = __webpack_require__(543);
|
|
204
204
|
if(content.__esModule) content = content.default;
|
|
205
205
|
if(typeof content === 'string') content = [[module.id, content, '']];
|
|
206
206
|
if(content.locals) module.exports = content.locals;
|
|
207
207
|
// add the styles to the DOM
|
|
208
208
|
var add = (__webpack_require__(402)/* ["default"] */ .Z)
|
|
209
|
-
var update = add("
|
|
209
|
+
var update = add("5fd0399d", content, true, {"sourceMap":false,"shadowMode":false});
|
|
210
210
|
|
|
211
211
|
/***/ }),
|
|
212
212
|
|
|
213
|
-
/***/
|
|
213
|
+
/***/ 930:
|
|
214
214
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
215
215
|
|
|
216
216
|
// style-loader: Adds some css to the DOM by adding a <style> tag
|
|
217
217
|
|
|
218
218
|
// load the styles
|
|
219
|
-
var content = __webpack_require__(
|
|
219
|
+
var content = __webpack_require__(354);
|
|
220
220
|
if(content.__esModule) content = content.default;
|
|
221
221
|
if(typeof content === 'string') content = [[module.id, content, '']];
|
|
222
222
|
if(content.locals) module.exports = content.locals;
|
|
223
223
|
// add the styles to the DOM
|
|
224
224
|
var add = (__webpack_require__(402)/* ["default"] */ .Z)
|
|
225
|
-
var update = add("
|
|
225
|
+
var update = add("ae650eda", content, true, {"sourceMap":false,"shadowMode":false});
|
|
226
226
|
|
|
227
227
|
/***/ }),
|
|
228
228
|
|
|
@@ -1351,16 +1351,37 @@ var VAMapPolygon_component = normalizeComponent(
|
|
|
1351
1351
|
)
|
|
1352
1352
|
|
|
1353
1353
|
/* harmony default export */ var VAMapPolygon = (VAMapPolygon_component.exports);
|
|
1354
|
-
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/pug-plain-loader/index.js!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/Components/VAMapPlaceSearchInput.vue?vue&type=template&id=
|
|
1355
|
-
var
|
|
1354
|
+
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/pug-plain-loader/index.js!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/Components/VAMapPlaceSearchInput.vue?vue&type=template&id=0b77a6ce&scoped=true&lang=pug
|
|
1355
|
+
var VAMapPlaceSearchInputvue_type_template_id_0b77a6ce_scoped_true_lang_pug_render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"v-amap-place-search-input"},[_c('input',{ref:"input",class:{ 'is-disabled': _vm.disabled },attrs:{"disabled":_vm.disabled,"placeholder":_vm.placeholder},domProps:{"value":_vm.value},on:{"blur":function($event){return _vm.handleBlur()},"focus":function($event){return _vm.handleFocus()},"input":function($event){return _vm.handleInput($event)}}}),(_vm.placeList.length)?_c('div',{staticClass:"option-ctn"},_vm._l((_vm.placeList),function(place){return _c('div',{staticClass:"option",attrs:{"title":place.name + place.cityname},on:{"click":function($event){return _vm.handlePlaceSelect(place)}}},[_c('span',{staticClass:"name"},[_vm._v(_vm._s(place.name))]),_c('span',{staticClass:"city"},[_vm._v(_vm._s(place.cityname))])])}),0):_vm._e()])
|
|
1356
1356
|
}
|
|
1357
|
-
var
|
|
1358
|
-
|
|
1357
|
+
var VAMapPlaceSearchInputvue_type_template_id_0b77a6ce_scoped_true_lang_pug_staticRenderFns = []
|
|
1358
|
+
|
|
1359
|
+
|
|
1360
|
+
;// CONCATENATED MODULE: ./src/utils/isParentNode.js
|
|
1361
|
+
// 是否是父节点
|
|
1362
|
+
const isParentNode = function (parentObj, obj) {
|
|
1363
|
+
if (parentObj === obj) return false
|
|
1364
|
+
while (
|
|
1365
|
+
obj != undefined &&
|
|
1366
|
+
obj != null &&
|
|
1367
|
+
obj.tagName &&
|
|
1368
|
+
obj.tagName.toUpperCase() != 'BODY'
|
|
1369
|
+
) {
|
|
1370
|
+
if (obj == parentObj) {
|
|
1371
|
+
return true
|
|
1372
|
+
}
|
|
1373
|
+
obj = obj.parentNode
|
|
1374
|
+
}
|
|
1375
|
+
return false
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
/* harmony default export */ var utils_isParentNode = (isParentNode);
|
|
1359
1379
|
|
|
1360
1380
|
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/Components/VAMapPlaceSearchInput.vue?vue&type=script&lang=js
|
|
1361
1381
|
|
|
1362
1382
|
|
|
1363
1383
|
|
|
1384
|
+
|
|
1364
1385
|
/* harmony default export */ var VAMapPlaceSearchInputvue_type_script_lang_js = ({
|
|
1365
1386
|
name: 'VAMapPlaceSearchInput',
|
|
1366
1387
|
model: {
|
|
@@ -1388,91 +1409,135 @@ var VAMapPlaceSearchInputvue_type_template_id_01341cd6_scoped_true_lang_pug_stat
|
|
|
1388
1409
|
data() {
|
|
1389
1410
|
return {
|
|
1390
1411
|
AMap: null,
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1412
|
+
placeSearch: null,
|
|
1413
|
+
placeList: [],
|
|
1414
|
+
place: null
|
|
1394
1415
|
}
|
|
1395
1416
|
},
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1417
|
+
watch: {
|
|
1418
|
+
place() {
|
|
1419
|
+
this.$emit('change', this.place ? this.place.name : '')
|
|
1420
|
+
this.$emit(
|
|
1421
|
+
'locationChange',
|
|
1422
|
+
this.place
|
|
1423
|
+
? [this.place.location.lng, this.place.location.lat]
|
|
1424
|
+
: null
|
|
1425
|
+
)
|
|
1426
|
+
this.$emit('placeChange', this.place)
|
|
1427
|
+
}
|
|
1399
1428
|
},
|
|
1400
|
-
|
|
1401
|
-
this.
|
|
1429
|
+
mounted() {
|
|
1430
|
+
window.addEventListener('click', this.optionsHideListener, true)
|
|
1431
|
+
window.addEventListener('contextmenu', this.optionsHideListener, true)
|
|
1432
|
+
},
|
|
1433
|
+
beforeDestroy() {
|
|
1434
|
+
window.removeEventListener('click', this.optionsHideListener, true)
|
|
1435
|
+
window.removeEventListener(
|
|
1436
|
+
'contextmenu',
|
|
1437
|
+
this.optionsHideListener,
|
|
1438
|
+
true
|
|
1439
|
+
)
|
|
1402
1440
|
},
|
|
1403
1441
|
methods: {
|
|
1404
|
-
async
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
this.placeSearchListener = this.AMap.event.addListener(
|
|
1420
|
-
placeSearch,
|
|
1421
|
-
'complete',
|
|
1422
|
-
event => {
|
|
1423
|
-
var position = null
|
|
1424
|
-
if (
|
|
1425
|
-
event &&
|
|
1426
|
-
event.poiList &&
|
|
1427
|
-
event.poiList.pois &&
|
|
1428
|
-
event.poiList.pois.length
|
|
1429
|
-
) {
|
|
1430
|
-
position = [
|
|
1431
|
-
event.poiList.pois[0].location.lng,
|
|
1432
|
-
event.poiList.pois[0].location.lat
|
|
1433
|
-
]
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
|
-
if (!position && !this.customEnable) {
|
|
1437
|
-
this.clear()
|
|
1438
|
-
} else {
|
|
1439
|
-
this.$emit('change', this.placeName)
|
|
1440
|
-
this.$emit('locationChange', position)
|
|
1441
|
-
}
|
|
1442
|
+
async createPlaceSearch() {
|
|
1443
|
+
this.AMap = await loader.load()
|
|
1444
|
+
this.placeSearch = new this.AMap.PlaceSearch({
|
|
1445
|
+
extensions: 'all'
|
|
1446
|
+
})
|
|
1447
|
+
},
|
|
1448
|
+
async getPlaceList() {
|
|
1449
|
+
if (!this.placeSearch) {
|
|
1450
|
+
await this.createPlaceSearch()
|
|
1451
|
+
}
|
|
1452
|
+
this.placeSearch.search(this.value, (status, result) => {
|
|
1453
|
+
if (status === 'complete') {
|
|
1454
|
+
this.placeList = result?.poiList?.pois || []
|
|
1455
|
+
} else {
|
|
1456
|
+
this.placeList = []
|
|
1442
1457
|
}
|
|
1443
|
-
)
|
|
1458
|
+
})
|
|
1444
1459
|
},
|
|
1445
|
-
|
|
1446
|
-
this
|
|
1447
|
-
this
|
|
1460
|
+
async handleInput(event) {
|
|
1461
|
+
this.$emit('change', event.target.value)
|
|
1462
|
+
await this.$nextTick()
|
|
1463
|
+
this.getPlaceList()
|
|
1448
1464
|
},
|
|
1449
|
-
|
|
1450
|
-
this.
|
|
1451
|
-
this
|
|
1452
|
-
|
|
1465
|
+
handlePlaceSelect(place = null) {
|
|
1466
|
+
this.place = place
|
|
1467
|
+
this.placeList = []
|
|
1468
|
+
},
|
|
1469
|
+
handleFocus() {
|
|
1470
|
+
if (this.value?.trim()) {
|
|
1471
|
+
this.getPlaceList()
|
|
1472
|
+
}
|
|
1453
1473
|
},
|
|
1454
1474
|
handleBlur() {
|
|
1455
|
-
if (this.
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
}
|
|
1475
|
+
if (this.customEnable) return
|
|
1476
|
+
if (this.value !== this.place?.name) {
|
|
1477
|
+
this.clear()
|
|
1459
1478
|
}
|
|
1460
1479
|
},
|
|
1461
|
-
|
|
1462
|
-
this.$
|
|
1480
|
+
optionsHideListener(event) {
|
|
1481
|
+
if (utils_isParentNode(this.$el, event.target)) return
|
|
1482
|
+
this.placeList = []
|
|
1483
|
+
},
|
|
1484
|
+
clear() {
|
|
1485
|
+
this.place = null
|
|
1486
|
+
this.$emit('change', '')
|
|
1463
1487
|
}
|
|
1488
|
+
// async addListener() {
|
|
1489
|
+
// const autocomplete = new this.AMap.Autocomplete({
|
|
1490
|
+
// input: this.$refs.input
|
|
1491
|
+
// }),
|
|
1492
|
+
// placeSearch = new this.AMap.PlaceSearch({})
|
|
1493
|
+
|
|
1494
|
+
// this.autocompleteListener = this.AMap.event.addListener(
|
|
1495
|
+
// autocomplete,
|
|
1496
|
+
// 'select',
|
|
1497
|
+
// event => {
|
|
1498
|
+
// this.placeName = event.poi.name
|
|
1499
|
+
// placeSearch.search(event.poi.name)
|
|
1500
|
+
// }
|
|
1501
|
+
// )
|
|
1502
|
+
|
|
1503
|
+
// this.placeSearchListener = this.AMap.event.addListener(
|
|
1504
|
+
// placeSearch,
|
|
1505
|
+
// 'complete',
|
|
1506
|
+
// event => {
|
|
1507
|
+
// var position = null
|
|
1508
|
+
// if (
|
|
1509
|
+
// event &&
|
|
1510
|
+
// event.poiList &&
|
|
1511
|
+
// event.poiList.pois &&
|
|
1512
|
+
// event.poiList.pois.length
|
|
1513
|
+
// ) {
|
|
1514
|
+
// position = [
|
|
1515
|
+
// event.poiList.pois[0].location.lng,
|
|
1516
|
+
// event.poiList.pois[0].location.lat
|
|
1517
|
+
// ]
|
|
1518
|
+
// }
|
|
1519
|
+
|
|
1520
|
+
// if (!position && !this.customEnable) {
|
|
1521
|
+
// this.clear()
|
|
1522
|
+
// } else {
|
|
1523
|
+
// this.$emit('change', this.placeName)
|
|
1524
|
+
// this.$emit('locationChange', position)
|
|
1525
|
+
// }
|
|
1526
|
+
// }
|
|
1527
|
+
// )
|
|
1528
|
+
// },
|
|
1464
1529
|
}
|
|
1465
1530
|
});
|
|
1466
1531
|
|
|
1467
1532
|
;// CONCATENATED MODULE: ./src/Components/VAMapPlaceSearchInput.vue?vue&type=script&lang=js
|
|
1468
1533
|
/* harmony default export */ var Components_VAMapPlaceSearchInputvue_type_script_lang_js = (VAMapPlaceSearchInputvue_type_script_lang_js);
|
|
1469
|
-
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-76.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-76.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-76.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-76.use[3]!./node_modules/stylus-loader/index.js??clonedRuleSet-76.use[4]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/Components/VAMapPlaceSearchInput.vue?vue&type=style&index=0&id=
|
|
1470
|
-
var
|
|
1471
|
-
;// CONCATENATED MODULE: ./src/Components/VAMapPlaceSearchInput.vue?vue&type=style&index=0&id=
|
|
1534
|
+
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-76.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-76.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-76.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-76.use[3]!./node_modules/stylus-loader/index.js??clonedRuleSet-76.use[4]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/Components/VAMapPlaceSearchInput.vue?vue&type=style&index=0&id=0b77a6ce&prod&lang=stylus&scoped=true
|
|
1535
|
+
var VAMapPlaceSearchInputvue_type_style_index_0_id_0b77a6ce_prod_lang_stylus_scoped_true = __webpack_require__(453);
|
|
1536
|
+
;// CONCATENATED MODULE: ./src/Components/VAMapPlaceSearchInput.vue?vue&type=style&index=0&id=0b77a6ce&prod&lang=stylus&scoped=true
|
|
1472
1537
|
|
|
1473
|
-
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-76.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-76.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-76.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-76.use[3]!./node_modules/stylus-loader/index.js??clonedRuleSet-76.use[4]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/Components/VAMapPlaceSearchInput.vue?vue&type=style&index=1&id=
|
|
1474
|
-
var
|
|
1475
|
-
;// CONCATENATED MODULE: ./src/Components/VAMapPlaceSearchInput.vue?vue&type=style&index=1&id=
|
|
1538
|
+
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-76.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-76.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-76.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-76.use[3]!./node_modules/stylus-loader/index.js??clonedRuleSet-76.use[4]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/Components/VAMapPlaceSearchInput.vue?vue&type=style&index=1&id=0b77a6ce&prod&lang=stylus
|
|
1539
|
+
var VAMapPlaceSearchInputvue_type_style_index_1_id_0b77a6ce_prod_lang_stylus = __webpack_require__(930);
|
|
1540
|
+
;// CONCATENATED MODULE: ./src/Components/VAMapPlaceSearchInput.vue?vue&type=style&index=1&id=0b77a6ce&prod&lang=stylus
|
|
1476
1541
|
|
|
1477
1542
|
;// CONCATENATED MODULE: ./src/Components/VAMapPlaceSearchInput.vue
|
|
1478
1543
|
|
|
@@ -1486,11 +1551,11 @@ var VAMapPlaceSearchInputvue_type_style_index_1_id_01341cd6_prod_lang_stylus = _
|
|
|
1486
1551
|
|
|
1487
1552
|
var VAMapPlaceSearchInput_component = normalizeComponent(
|
|
1488
1553
|
Components_VAMapPlaceSearchInputvue_type_script_lang_js,
|
|
1489
|
-
|
|
1490
|
-
|
|
1554
|
+
VAMapPlaceSearchInputvue_type_template_id_0b77a6ce_scoped_true_lang_pug_render,
|
|
1555
|
+
VAMapPlaceSearchInputvue_type_template_id_0b77a6ce_scoped_true_lang_pug_staticRenderFns,
|
|
1491
1556
|
false,
|
|
1492
1557
|
null,
|
|
1493
|
-
"
|
|
1558
|
+
"0b77a6ce",
|
|
1494
1559
|
null
|
|
1495
1560
|
|
|
1496
1561
|
)
|
|
@@ -1512,7 +1577,7 @@ var VAMapPlaceSearchInput_component = normalizeComponent(
|
|
|
1512
1577
|
]);
|
|
1513
1578
|
|
|
1514
1579
|
;// CONCATENATED MODULE: ./package.json
|
|
1515
|
-
var package_namespaceObject = {"i8":"1.
|
|
1580
|
+
var package_namespaceObject = {"i8":"1.3.0"};
|
|
1516
1581
|
;// CONCATENATED MODULE: ./src/config/index.js
|
|
1517
1582
|
|
|
1518
1583
|
|