在开发过程中,map中的iconPath是可以展示
icon-map-company.png

准备在手机上查看的时候,发现图片是这样的
微信图片_20200408170023.jpg

发现问题就得解决!!!
经过一系列操作之后,终于解决了这个问题.

let img = ''
                switch (this.chooseType){
                    case 'company':
                        img = require('../../../static/img/icon-map-company.png')
                        break;
                    case 'build':
                        img = require('../../../static/img/icon-map-build.png')
                        break;
                    case 4:
                        img = require('../../../static/img/icon-map-land.png')
                        break;
                }
                return img

上面是手机无法正常显示的代码

so下面就是解决办法

let img = ''
                switch (this.chooseType){
                    case 'company':
                        img = '/static/img/icon-map-company.png'
                        break;
                    case 'build':
                        img = '/static/img/icon-map-build.png'
                        break;
                    case 4:
                        img = '/static/img/icon-map-land.png'
                        break;
                }
                return img

没想到吧,就是这么简单粗暴!


柚花离海
16 声望2 粉丝

伪前端