【发布时间】:2019-11-20 02:08:45
【问题描述】:
我有一个 vue-google-map 需要在单击标记时显示一些内容。 如何设置 infoWindow 的样式?这是我的代码,它将 id iw-container 调用到 css 表中。
this.infoWindow.position = location;
this.infoWindow.template = '<div class="iw-container"><div
style="width:100%;">NAME OF PIN</div>'
+ '<div style="width:100%;">name and info</div></div>';
this.infoWindow.open = true;
这是css:
#iw-container {
background-color:pink;
}
但是 infoWindow 没有任何反应。
我也尝试将样式直接设置为这样的内容:
this.infoWindow.position = location;
this.infoWindow.template = '<div style="background-color:pink;"><div
style="width:100%;">NAME OF PIN</div>'
+ '<div style="width:100%;">name and info</div></div>';
this.infoWindow.open = true;
但是颜色没有完全满足infoWindow。谁能建议我能做什么或我应该改变什么?
【问题讨论】:
-
你看到this part of the documentation了吗?还有this example(它所指的)?
-
@geocodezip ,从这个例子中,我认为它可以是这样的。
<gmap-info-window :options="{ maxWidth: 300, pixelOffset: { width: 0, height: -35 }, background: 'blue', //changing background-color }" :position="infoWindow.position" :opened="infoWindow.open" @closeclick="infoWindow.open=false" >但什么也没发生。背景颜色的最佳变量是什么?我尝试了背景和背景颜色,但都不起作用 -
这是我将信息窗口背景(和茎/箭头)更改为绿色的示例:jsfiddle.net/geocodezip/1oyertb2/1
-
谢谢,我会看看它,需要时间来理解它,因为我很难想到如何将这个纯 JS 应用到 vue.js 的东西中。
标签: javascript css google-maps