在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ vue關(guān)于導(dǎo)入iframe的問題

vue關(guān)于導(dǎo)入iframe的問題

下圖為iframe,想要一個(gè)百度地圖的API,百度API,但是不知道怎么用,我用的vue,這該怎么用?

圖片描述

<template>
    <div class="map_wrap">
        <iframe src=""></iframe>
    </div>
</template>

求大神指教

回答
編輯回答
喵小咪
2018年4月23日 17:56
編輯回答
嘟尛嘴

map.js

export function MP(ak) {  
  return new Promise(function (resolve, reject) {  
    window.onload = function () {  
      resolve(BMap)  
    }  
    var script = document.createElement("script");  
    script.type = "text/javascript";  
    script.src = "http://api.map.baidu.com/api?v=2.0&ak="+ak+"&callback=init";  
    script.onerror = reject;  
    document.head.appendChild(script);  
  })  
}  

import {MP} from 'map.js'

mounted(){  
    this.$nextTick(function(){  
        var _this = this;  
        MP(_this.ak).then(BMap => {  //ak就是你的密鑰
        //在此調(diào)用api  
    })
2017年9月9日 12:55