小编fon*_*ane的帖子

如何将传单导入角度项目?

我正在尝试在我的 Angular 项目中使用 leatflet 包,但我无法让它工作。

我安装了 leatfletnpm install leatflet --save然后我在angular.json文件中包含了依赖项:

"styles": [
            "node_modules/leaflet/dist/leaflet.css",
],
"scripts": [
            "node_modules/leaflet/dist/leaflet.js"
],
Run Code Online (Sandbox Code Playgroud)

我的app.component.ts文件:

import { Component, OnInit } from '@angular/core';
import * as L from 'leaflet';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{


  constructor() {}

  ngOnInit() {
    const myMap = L.map('map').setView([51.505, -0.09], 13);
  }

  onAdressSubmit(form) {
    console.log(form.value.adress);
  }
}
Run Code Online (Sandbox Code Playgroud)

在里面app.component.html我有一个id为map的部分。

我看到的只有这个: 传单

有人知道问题出在哪里以及如何解决吗?

帮助将不胜感激。:)

import leaflet angular

3
推荐指数
1
解决办法
6073
查看次数

如果绑定的布尔属性为 false,如何将 xaml 元素的 IsVisible 属性设置为 true?

我想知道如果绑定属性的布尔值为 false,是否或如何将 xaml 元素的 IsVisible 属性设置为 true?

根据布尔属性的值,我想有条件地在视图中渲染不同的元素。

这是我的代码:

<ContentPage ...
  x:Name="page">

  <ListView BindingContext="{x:Reference page}" ItemSource="digitalInputs">
    <ListView.ItemTemplate>
      <DataTemplate x:DataType="services:DigitalInput">
        <ViewCell>
          <HorizontalStackLayout>
            <!-- This seems to be working. Render a green ball, if boolean value is true -->
            <Image Source="ballgreen" IsVisible="{Binding value}"/>
            <!-- Doesn't work. I want to render a red ball if the boolean value is false. -->
            <Image Source="ballred" IsVisible="{Binding !value}"/>
            <Label Text="{Binding valueText}" />
          </HorizontalStackLayout>
        </ViewCell>
      </DataTemplate>
    </ListView.ItemTemplate>
  </ListView>
</ContentPage>
Run Code Online (Sandbox Code Playgroud)

我考虑过向 DigitalInput 类添加另一个布尔属性,并将其值设置为 的相反值value,但另一方面,我不想触及该类,因为它以 1:1 的方式模拟我从 …

.net c# xaml maui

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

标签 统计

.net ×1

angular ×1

c# ×1

import ×1

leaflet ×1

maui ×1

xaml ×1