我正在尝试使用需要上下文实例化UI对象的本机映射库,如何传递它?
原生函数是android.view.View的扩展,其所需的参数是上下文。
Example.vue:
<template>
<Page class="page">
<StackLayout>
<Placeholder @creatingView="creatingView"/>
</StackLayout>
</Page>
</template>
<script>
export default {
methods: {
creatingView(args){
//This is where I need the context as a parameter
const nativeView = new com.esri.arcgisruntime.mapping.view.MapView(this.context);
args.view = nativeView;
}
}
};
</script>
答案 0 :(得分:0)
无论使用哪种样式/框架,都可以使用以下应用程序上下文
import * as application from "application";
const context = application.android.context;
答案 1 :(得分:0)
您可以从createdView事件args获取当前的android上下文。
methods: {
creatingView(args){
const nativeView = new com.esri.arcgisruntime.mapping.view.MapView(args.context);
args.view = nativeView;
}
}