小编Zen*_*san的帖子

使用javascript扩展typescript库

我正在使用Ionic 3来构建一个简单的地图应用程序,以便使用OpenStreet地图图块呈现我正在使用传单(类型版本)的地图

我想让用户下载和缓存地图的可能性,因此我在这里找到了传单离线 并希望使用它,因为它允许我使用我的本地存储来存储图像.

现在我的问题出现了,我正在尝试将打字稿与javascript混合,我无法弄清楚如何使其正常工作.

我做了什么,问题是什么:

我安装了传单类型版本,然后安装了传单离线javascript版本.

现在我在页面中将它们导入如下:

import * as leaflet from 'leaflet';
import 'leaflet-offline';
Run Code Online (Sandbox Code Playgroud)

现在,如果我尝试按照示例中的说明使用库,我会得到一个打字稿错误,它指示我离线的属性不在对象TileLayer中.

leaflet.tileLayer.offline('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', tilesDb, {
    attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
    subdomains: 'abc',
    minZoom: 13,
    maxZoom: 19,
    crossOrigin: true
}).addTo(this.map);
Run Code Online (Sandbox Code Playgroud)

为了避免这种情况,我补充道

export namespace tileLayer {
function wms(baseUrl: string, options?: WMSOptions, offline?: any): TileLayer.WMS;
function offline(url?: any, tilesDb?: any, options?: any): any;
}
Run Code Online (Sandbox Code Playgroud)

该函数offline位于tileLayer本身的命名空间中.

当前的问题 在我尝试运行应用程序的那一刻,一切正常,除了实际的地图,我看不到它,当我调查它时得到的错误如下:

错误类型错误:无法在NewClass._TateUrl(vendor.js:163489)的NewClass._addTile(vendor.js:79419)的NewClass._update(供应商,js:73419)的NewClass.getTileUrl(vendor.js:163489)中读取null的属性'then' .js:79310)在NewClass._setView(vendor.js:79171)的NewClass._resetView(vendor.js:79129)NewClass.fire(vendor.js:68787)NewClass._move(vendor.js:72343)at at NewClass._catchTransitionEnd中的NewClass._onZoomTransitionEnd(vendor.js:72800)(vendor.js:72732)

我确定我犯了一些愚蠢的错误,但我在这个问题上失去了很多时间.

任何人都有一些关于如何解决这个问题的线索?

javascript leaflet typescript ionic3

6
推荐指数
1
解决办法
258
查看次数

.NET Core 中的 WSDL 端点配置

我正在尝试使用 .NET 核心处理 WSDL。目前,我可以导入 WSDL 并生成相关文件:

.NET 核心连接服务生成的文件

结构以正确的方式完成,似乎一切都应该按预期进行。现在在 ASP.NET 中,我会有一个包含以下信息的 XML:

 <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="SI_SearchItem_OutBinding" />
        <binding name="SI_SearchItem_OutBinding1">
            <security mode="Transport">
                <transport clientCredentialType="Basic" proxyCredentialType="Basic" realm="XISOAPApps" />
                <message clientCredentialType="UserName" algorithmSuite="Default" />
            </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="HTTP_ENDPOINT_LINK"
        binding="basicHttpBinding" bindingConfiguration="SI_SearchItem_OutBinding"
        contract="SI_Out.SI_SearchItem_Out" name="HTTP_Port" />
      <endpoint address="HTTPS_ENDPOINT_LINK"
        binding="basicHttpBinding" bindingConfiguration="SI_SearchItem_OutBinding1"
        contract="SI_Out.SI_SearchItem_Out" name="HTTPS_Port" />
    </client>
  </system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

由于我们不再有web.config核心,我正在尝试以编程方式添加这些配置。

在看的时候,Reference.cs我注意到两件事:

  1. ConfigureEndpoint 没有在生成的文件中实现,这让我觉得我需要在那里做我的配置。
  2. ConfigureEndpoint 定义如下: static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials);

但是这个函数被调用

public SI_SearchItem_OutClient(EndpointConfiguration endpointConfiguration) : 
            base(SI_SearchItem_OutClient.GetBindingForEndpoint(endpointConfiguration), SI_SearchItem_OutClient.GetEndpointAddress(endpointConfiguration))
    {
        this.Endpoint.Name = endpointConfiguration.ToString();
        ConfigureEndpoint(this.Endpoint, this.ClientCredentials); …
Run Code Online (Sandbox Code Playgroud)

.net c# wsdl .net-core

6
推荐指数
1
解决办法
1670
查看次数

Bootstrap不显示所有glyphicon

我对bootstrap glyphicon有一些问题.

我目前在我的项目中使用了很多glyphocon,但我不能全部使用它们.

我会试着更好地解释自己.

<span class="glyphicon glyphicon-th-large text-primary"></span>
Run Code Online (Sandbox Code Playgroud)

这个,在我的网站上正常工作,但是:

<span class="glyphicon glyphicon-sunglasses text-primary"></span>
Run Code Online (Sandbox Code Playgroud)

这不是.

我试着下载一个干净的bootstrap,我只需要取出字体文件夹并替换我项目中的文件.但没有改变.

我有一些随机的glyphicon这个问题,而不是所有这些问题.

我真的不知道为什么:/

Ps我已经尝试了这个:Bootstrap 3无法正确显示glyphicon

css twitter-bootstrap glyphicons

4
推荐指数
1
解决办法
4980
查看次数

Angular ngFor使用地图

我使用的是离子3,因此是角度和打字稿。

我想要实现的是将ngFor与Map类型结合使用。

这是我所拥有的:

interface IShared_Position {
lat: number;
lng: number;
time: number;
color?: string;
}
public shared_position = new Map<string, IShared_Position>();
Run Code Online (Sandbox Code Playgroud)

现在从html方面,我有:

    <ion-list>
  <ion-item ion-item *ngFor="let item of shared_position">
    <h2>{{ item.time }}</h2>
  </ion-item>
Run Code Online (Sandbox Code Playgroud)

现在,这给了我以下错误:

错误:找不到类型为“对象”的其他支持对象“ [对象图]”。NgFor仅支持绑定到Iterables,例如数组。

现在有什么可能的方法,即使它不是可迭代的,我也无法绑定我的地图?

我该怎么办?

iterable typescript ngfor angular

1
推荐指数
2
解决办法
2980
查看次数