【发布时间】:2019-04-28 06:27:59
【问题描述】:
我有一个 Nativescript Vue 组件模板定义为:
<ScrollView>
<StackLayout>
<ContentView ref="mapContainer" height="500" width="100%">
<Mapbox
accessToken="my access key"
mapStyle="outdoors-v9"
hideCompass="true"
zoomLevel="10.2" ,
latitude="51.949266"
longitude="-12.183571"
showUserLocation="true"
disableZoom="true"
disableRotation="true"
disableScroll="true"
disableTilt="true"
@mapReady="onMapReady($event)">
</Mapbox>
</ContentView>
<Label text="A test label"/>
</StackLayout>
</ScrollView>
安装组件后,我想将mapContainer 的高度设置为屏幕高度的大约75%。为此,我有:
export default {
name: "MyPage",
mounted () {
this.$refs.mapContainer.height = platform.screen.mainScreen.heightDIPs
}
...
}
但这没有任何作用,ContentView 保持在 500dp 高。
height 本来是一个二传手,但我想我错过了重绘 (?) 以使此更改生效,但不确定如何?
【问题讨论】:
标签: nativescript nativescript-vue