如何将地图监听器添加到地图页面上 [英] How to add map listeners onto map page

查看:97
本文介绍了如何将地图监听器添加到地图页面上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将地图侦听器添加到我的第一个地图页面?
我看到很多创建地图并将其放入页面的示例,但在我的代码中,地图本身就是一个页​​面。
所以我不知道如何以这种方式添加地图监听器。

  Ext.define('myapp.view .Main',{
extend:'Ext.tab.Panel',
xtype:'main',
fullscreen:true,
require:[
'Ext .TitleBar',
'Ext.Video',
'Ext.Map',
'Ext.Panel',
'Ext.tab。*',
'分机*'
],
配置:{
tabBarPosition:'bottom',

物品:[
{
title: 'WebTrack',
iconCls:'maps',
xtype:'map',
useCurrentLocation:true,
store:'my.store.appleStore',

}

有人可以帮忙吗?

非常感谢

解决方案

最后,我找到了答案。

遵循以下步骤:


  1. 在控制器中创建映射组件。
  2. Ext.define('myapp.controller.Noises',{
    extend:'Ext.app.Controller',
    require:['Ext.MessageBox'],
    config:{
    refs:{
    mapComponent:'main map '
    },
    control:{
    mapComponent:{
    maprender:'onMaprender'
    }
    }
    },


因此,onMapprender是您可以开始编写代码的地方。



希望它有帮助。



干杯


How to I add a map listener to my first map page? I saw many examples which create a map and put it into a page, but here in my code, the map itself is a page. So I do not know how to add map listeners in this way.

Ext.define('myapp.view.Main', {
    extend: 'Ext.tab.Panel',
    xtype: 'main',
    fullscreen: true,
    requires: [
        'Ext.TitleBar',
        'Ext.Video',
        'Ext.Map',
        'Ext.Panel',
        'Ext.tab.*',
        'Ext.*'
    ],
    config: {
        tabBarPosition: 'bottom',

      items: [
            {
                title: 'WebTrack',
                iconCls:'maps',
                xtype: 'map',
                useCurrentLocation: true,
                store: 'my.store.appleStore',

            }

Can someone help please?

Thanks very much

解决方案

Finally, I found the answer.

Steps to follow:

  1. create a map component in controller.
  2. Ext.define('myapp.controller.Noises', { extend: 'Ext.app.Controller', requires: ['Ext.MessageBox'], config: { refs: { mapComponent: 'main map' }, control: { mapComponent: { maprender: 'onMaprender' } } },

So the onMapprender is where you can start to write your code.

Hope it helps.

Cheers

这篇关于如何将地图监听器添加到地图页面上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆