提交 6d31ef09 编写于 作者: Mosher's avatar Mosher

修复地图定位插件初始无值不加载地图的问题

上级 d1abc6ea
...@@ -115,7 +115,7 @@ export default class AppMapPosition extends Vue { ...@@ -115,7 +115,7 @@ export default class AppMapPosition extends Vue {
* @type {*} * @type {*}
* @memberof AppMapPosition * @memberof AppMapPosition
*/ */
@Prop() public formState!: Subject<any>;; @Prop() public formState!: Subject<any>;
/** /**
* 搜索框显示值 * 搜索框显示值
...@@ -234,7 +234,7 @@ export default class AppMapPosition extends Vue { ...@@ -234,7 +234,7 @@ export default class AppMapPosition extends Vue {
* @memberof AppMapPosition * @memberof AppMapPosition
*/ */
public initMap() { public initMap() {
if(!this.mode || !this.value) { if(!this.mode) {
return; return;
} }
if(Object.is(this.mode, 'address')) { if(Object.is(this.mode, 'address')) {
...@@ -252,7 +252,7 @@ export default class AppMapPosition extends Vue { ...@@ -252,7 +252,7 @@ export default class AppMapPosition extends Vue {
* @memberof AppMapPosition * @memberof AppMapPosition
*/ */
public initByAddress() { public initByAddress() {
if(this.longitude && this.latitude && this.data) { if(this.longitude && this.latitude && this.data && this.value) {
const position = [this.data[this.longitude], this.data[this.latitude]]; const position = [this.data[this.longitude], this.data[this.latitude]];
Object.assign(this.marker, { Object.assign(this.marker, {
position: position, position: position,
...@@ -278,7 +278,7 @@ export default class AppMapPosition extends Vue { ...@@ -278,7 +278,7 @@ export default class AppMapPosition extends Vue {
* @memberof AppMapPosition * @memberof AppMapPosition
*/ */
public initByLng() { public initByLng() {
if(this.latitude && this.data) { if(this.latitude && this.data && this.value) {
this.handleMarker(this.value, this.data[this.latitude], this); this.handleMarker(this.value, this.data[this.latitude], this);
} else { } else {
Object.assign(this.marker, { Object.assign(this.marker, {
...@@ -296,7 +296,7 @@ export default class AppMapPosition extends Vue { ...@@ -296,7 +296,7 @@ export default class AppMapPosition extends Vue {
* @memberof AppMapPosition * @memberof AppMapPosition
*/ */
public initByLat() { public initByLat() {
if(this.longitude && this.data) { if(this.longitude && this.data && this.value) {
this.handleMarker(this.data[this.longitude], this.value, this); this.handleMarker(this.data[this.longitude], this.value, this);
} else { } else {
Object.assign(this.marker, { Object.assign(this.marker, {
...@@ -333,6 +333,9 @@ export default class AppMapPosition extends Vue { ...@@ -333,6 +333,9 @@ export default class AppMapPosition extends Vue {
public handleMapShow() { public handleMapShow() {
this.resultShow = false; this.resultShow = false;
this.dialogShow = true; this.dialogShow = true;
if(!this.markerResult || JSON.stringify(this.markerResult) == "{}") {
return;
}
this.searchAddress = this.markerResult.address; this.searchAddress = this.markerResult.address;
Object.assign(this.marker, this.markerResult); Object.assign(this.marker, this.markerResult);
this.center = this.markerResult.position; this.center = this.markerResult.position;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册