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

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

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